Skip to content

Commit

Permalink
UI Fixes for OIDC
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 29, 2022
1 parent f336210 commit b2ba018
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 61 deletions.
20 changes: 6 additions & 14 deletions backend/src/main/resources/metadata-sources-ui-schema-oidc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"entityId"
],
"properties": {
"protocol": {
"title": "label.source-protocol",
"description": "tooltip.source-protocol",
"type": "string"
},
"serviceProviderName": {
"title": "label.service-provider-name",
"description": "tooltip.service-provider-name",
Expand Down Expand Up @@ -111,20 +116,7 @@
"widget": {
"id": "select"
},
"oneOf": [
{
"enum": ["SAML 2"],
"description": "SAML 2"
},
{
"enum": ["SAML 1.1"],
"description": "SAML 1.1"
},
{
"enum": ["http://openid.net/specs/openid-connect-core-1_0.html"],
"description": "OIDC"
}
]
"default": "http://openid.net/specs/openid-connect-core-1_0.html"
},
"nameIdFormats": {
"$ref": "#/definitions/nameIdFormats"
Expand Down
13 changes: 7 additions & 6 deletions backend/src/main/resources/metadata-sources-ui-schema-saml.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"entityId"
],
"properties": {
"protocol": {
"title": "label.source-protocol",
"description": "tooltip.source-protocol",
"type": "string"
},
"serviceProviderName": {
"title": "label.service-provider-name",
"description": "tooltip.service-provider-name",
Expand Down Expand Up @@ -110,15 +115,11 @@
},
"oneOf": [
{
"enum": [
"SAML 2"
],
"enum": ["SAML 2"],
"description": "SAML 2"
},
{
"enum": [
"SAML 1.1"
],
"enum": ["SAML 1.1"],
"description": "SAML 1.1"
}
]
Expand Down
37 changes: 13 additions & 24 deletions ui/public/assets/schema/source/metadata-source-saml.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,9 @@
"items": { "$ref": "#/definitions/Contact" }
},
"mdui": { "$ref": "#/definitions/MDUI" },
"dependencies": {
"securityInfo": {
"oneOf": [
{
"properties": {
"@type": {
"enum": [
"OIDC"
]
}
}
}
]
}
},
"securityInfo": {
"type": "object",
"widget": { "id": "fieldset" },
"dependencies": {
"authenticationRequestsSigned": {
"oneOf": [
Expand All @@ -59,15 +45,15 @@
"authenticationRequestsSigned": {
"enum": [true]
},
"keyDescriptors": { "minItems": 1 }
"x509Certificates": { "minItems": 1 }
}
},
{
"properties": {
"authenticationRequestsSigned": {
"enum": [false]
},
"keyDescriptors": { "minItems": 0 }
"x509Certificates": { "minItems": 0 }
}
}
]
Expand Down Expand Up @@ -265,7 +251,7 @@
},
"Certificate": {
"type": "object",
"required": ["type", "value"],
"required": ["type", "value", "elementType"],
"properties": {
"name": {
"title": "label.certificate-name-display-only",
Expand Down Expand Up @@ -354,6 +340,12 @@
"urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
],
"description": "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
},
{
"enum": [
"https://tools.ietf.org/html/rfc6749#section-3.1.2"
],
"description": "OIDC / OAUTH Binding"
}
]
},
Expand Down Expand Up @@ -487,28 +479,25 @@
"title": "label.organization-name",
"description": "tooltip.organization-name",
"type": "string",
"minLength": 1,
"maxLength": 255
},
"displayName": {
"title": "label.organization-display-name",
"description": "tooltip.organization-display-name",
"type": "string",
"minLength": 1,
"maxLength": 255
},
"url": {
"title": "label.organization-url",
"description": "tooltip.organization-url",
"type": "string",
"minLength": 1,
"maxLength": 255
}
},
"dependencies": {
"name": { "required": ["displayName", "url"] },
"displayName": { "required": ["name", "url"] },
"url": { "required": ["name", "displayName"] }
"url": ["name", "displayName"],
"name": ["displayName", "url"],
"displayName": ["name", "url"]
}
},
"nameIdFormats": {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/dashboard/view/SourcesTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Spinner } from '../../core/components/Spinner';
import { NotificationContext, createNotificationAction, NotificationTypes } from '../../notifications/hoc/Notifications';


const searchProps = ['serviceProviderName', 'entityId', 'createdBy'];
const searchProps = ['serviceProviderName', 'entityId', 'createdBy', 'protocol'];

export function SourcesTab () {

Expand Down
5 changes: 4 additions & 1 deletion ui/src/app/form/component/widgets/SelectWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ const SelectWidget = ({
</span>
{schema.description && <InfoIcon value={schema.description} className="ms-2" />}
</Form.Label>
{readonly ?
<Form.Control readOnly={readonly} value={value} />
:
<Form.Select
id={id}
value={typeof value === "undefined" ? emptyValue : value}
required={required}
multiple={multiple}
disabled={disabled}
readOnly={readonly}
autoFocus={autofocus}
className={touched && rawErrors?.length > 0 ? "is-invalid" : ""}
onBlur={
Expand Down Expand Up @@ -134,6 +136,7 @@ const SelectWidget = ({
</option>
)}
</Form.Select>
}
{rawErrors?.length > 0 && touched && (
<ListGroup as="ul">
{rawErrors.map((error, i) => {
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/metadata/domain/source/component/SourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
<tr>
<th className="w-25"><Translate value="label.title">Title</Translate></th>
<th className="w-25"><Translate value="label.entity-id">Entity ID</Translate></th>
<th className=""><Translate value="label.metadata-source-protocol">Protocol</Translate></th>
<th className=""><Translate value="label.author">Author</Translate></th>
<th className=""><Translate value="label.creation-date">Created Date</Translate></th>
<th className="text-center"><Translate value="label.enabled">Enabled</Translate></th>
Expand All @@ -55,6 +56,9 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
<td className="align-middle">
{source.entityId}
</td>
<td className="align-middle">
{source.protocol}
</td>
<td className="align-middle">
{source.createdBy}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,28 @@ export const OidcSourceEditor = defaultsDeep({
}
]
},
protocolSupportEnum: {
"ui:readonly": true
},
extensions: {
OAuthRPExtensions: {
layout: {
groups: [
{
classNames: 'col-md-6 col-xs-12',
fields: [
'attributes'
],
},
{
classNames: 'border-start col-md-6 col-xs-12',
fields: [
'postLogoutRedirectUris',
'defaultAcrValues',
'requestUris',
'audience'
],
},
{
fields: [
'attributes'
],
}
]
},
postLogoutRedirectUris: {
Expand Down Expand Up @@ -99,25 +104,28 @@ export const OidcSourceWizard = defaultsDeep({
}
]
},
protocolSupportEnum: {
"ui:readonly": true
},
extensions: {
OAuthRPExtensions: {
layout: {
groups: [
{
classNames: 'col-md-6 col-xs-12',
fields: [
'attributes'
],
},
{
classNames: 'border-start col-md-6 col-xs-12',
fields: [
'postLogoutRedirectUris',
'defaultAcrValues',
'requestUris',
'audience'
],
},
{
classNames: 'col-md-6 col-xs-12',
fields: [
'attributes'
],
}
]
},
postLogoutRedirectUris: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import defaultsDeep from 'lodash/defaultsDeep';
import API_BASE_PATH from '../../../../App.constant';
import {API_BASE_PATH} from '../../../../App.constant';
import { SourceBase, SourceEditor, SourceWizard } from './SourceDefinition';

export const SamlSourceBase = defaultsDeep({
Expand All @@ -19,8 +19,6 @@ export const SamlSourceBase = defaultsDeep({
}, SourceBase.uiSchema)
}, SourceBase);

console.log(SamlSourceBase);

export const SamlSourceEditor = defaultsDeep({
...SourceEditor,
}, SamlSourceBase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function MetadataSourceProtocolSelector({ types = [], loading, children})
reValidateMode: 'onChange',
defaultValues: {
serviceProviderName: null,
protocol: null,
protocol: 'SAML',
entityID: null,
},
resolver: undefined,
Expand Down

0 comments on commit b2ba018

Please sign in to comment.