From 5ea26dc7eafd014e648c358a252ff95022bc8dc4 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 25 May 2021 17:36:28 -0400 Subject: [PATCH] feature: add array fields to oidc form --- addons/core/translations/en-us.yaml | 2 + addons/core/translations/form/en-us.yaml | 30 ++ .../styles/rose/components/table/_table.scss | 8 +- .../form/auth-method/oidc/index.hbs | 273 +++++++++++++++++- .../components/form/auth-method/oidc/index.js | 17 ++ 5 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 ui/admin/app/components/form/auth-method/oidc/index.js diff --git a/addons/core/translations/en-us.yaml b/addons/core/translations/en-us.yaml index 56621bf33..5370c7e75 100644 --- a/addons/core/translations/en-us.yaml +++ b/addons/core/translations/en-us.yaml @@ -27,6 +27,8 @@ titles: abandon-confirm: Discard unsaved changes? toggle-color-theme: Toggle Color Theme welcome-to-boundary: Welcome to Boundary + label: Label + value: Value descriptions: empty-set: There are no items to display yet. You may be able to add items or try back later. origin-initialization: To get started, please enter your origin URL diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 974b2d313..1345b4509 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -70,3 +70,33 @@ disable_discovered_config_validation: label: Disable discovered config validation help: > If the Authorization Server's discovered configuration contains values that do not match the configuration set on this auth method, this can be set to force the local configuration to override the discovered values. This is useful in the case of slow-changing or incorrect values announced by the Authorization Server. NOTE: For safety, not providing this value will be treated the same as "false"; that is, every time the method is updated or the state is changed, this value must be set to "true" or it will be disabled. +idp_ca_certs: + label: Certificates + help: Optional PEM-encoded X.509 CA certificates that can be used as trust anchors when connecting to an OIDC provider. +certificate: + label: Certificate +allowed_audiences: + label: Allowed Audiences + help: Allowed audience claims for this auth method. +claim: + label: Claim +claims_scopes: + label: Claims Scopes + help: Optional claims scopes that will be requested during authentication. +claims_scope: + label: Claims Scope +account_claim_maps: + label: Account Claim Maps + help: > + Optional claim maps from custom claims to the standard claims of sub, name and email. These maps are represented as key=value where the key equals the from_claim and the value equals the to_claim. For example "oid=sub". +account_claim_map: + label: Account Claim Map +from_claim: + label: From Claim +to_claim: + label: To Claim +signing_algorithms: + label: Signing Algorithms + help: The signing algorithms allowed for the auth method. +algorithm: + label: Algorithm diff --git a/addons/rose/addon/styles/rose/components/table/_table.scss b/addons/rose/addon/styles/rose/components/table/_table.scss index 81a815a24..c4a839020 100644 --- a/addons/rose/addon/styles/rose/components/table/_table.scss +++ b/addons/rose/addon/styles/rose/components/table/_table.scss @@ -11,13 +11,19 @@ } // This styles are add to stop the input to apply extra margin (default on forms) + .rose-form-input, .rose-form-input-field, .rose-form-select, - .rose-form-input { + .rose-form-select-field { margin: 0; width: 100%; } + // Fix margin issue with textarea elements inside tables + textarea { + display: block; + } + .rose-table-cell, .rose-table-header-cell { vertical-align: middle; diff --git a/ui/admin/app/components/form/auth-method/oidc/index.hbs b/ui/admin/app/components/form/auth-method/oidc/index.hbs index f157e5090..c7ac8ad4a 100644 --- a/ui/admin/app/components/form/auth-method/oidc/index.hbs +++ b/ui/admin/app/components/form/auth-method/oidc/index.hbs @@ -119,6 +119,277 @@ {{/if}} + {{! Signing Algorithms }} + + <:title>{{t 'form.signing_algorithms.label'}} + <:description>{{t 'form.signing_algorithms.help'}} + <:body> + + + + {{t 'titles.value'}} + {{t 'titles.actions'}} + + + + {{#each @model.attributes.signing_algorithms as |algorithm i|}} + + + + {{t 'form.algorithm.label'}} + + {{#each this.signingAlgorithms as |algorithm|}} + {{algorithm}} + {{/each}} + + {{#if @model.errors.attributes.signing_algorithms}} + + {{#each @model.errors.attributes.signing_algorithms as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + {{! Certificates }} + + <:title>{{t 'form.idp_ca_certs.label'}} + <:description>{{t 'form.idp_ca_certs.help'}} + <:body> + + + + {{t 'titles.value'}} + {{t 'titles.actions'}} + + + + {{#each @model.attributes.idp_ca_certs as |cert i|}} + + + + {{t 'form.certificate.label'}} + + {{#if @model.errors.attributes.idp_ca_certs}} + + {{#each @model.errors.attributes.idp_ca_certs as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + {{! Allowed Audiences }} + + <:title>{{t 'form.allowed_audiences.label'}} + <:description>{{t 'form.allowed_audiences.help'}} + <:body> + + + + {{t 'titles.value'}} + {{t 'titles.actions'}} + + + + {{#each @model.attributes.allowed_audiences as |audience i|}} + + + + {{t 'form.claim.label'}} + + {{#if @model.errors.attributes.allowed_audiences}} + + {{#each @model.errors.attributes.allowed_audiences as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + {{! Claims Scopes }} + + <:title>{{t 'form.claims_scopes.label'}} + <:description>{{t 'form.claims_scopes.help'}} + <:body> + + + + {{t 'titles.value'}} + + + + + {{#each @model.attributes.claims_scopes as |claimsScope i|}} + + + + {{t 'form.claims_scope.label'}} + + {{#if @model.errors.attributes.claims_scopes}} + + {{#each @model.errors.attributes.claims_scopes as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + {{! Account Claim Maps }} + + <:title>{{t 'form.account_claim_maps.label'}} + <:description>{{t 'form.account_claim_maps.help'}} + <:body> + + + + {{t 'form.from_claim.label'}} + {{t 'form.to_claim.label'}} + {{t 'titles.actions'}} + + + + {{#each @model.attributes.account_claim_maps as |claimMap i|}} + + + + {{t 'form.from_claim.label'}} + + {{#if @model.errors.attributes.account_claim_maps}} + + {{#each @model.errors.attributes.account_claim_maps as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'form.to_claim.label'}} + + {{#each this.toClaims as |toClaim|}} + {{toClaim}} + {{/each}} + + {{#if @model.errors.attributes.account_claim_maps}} + + {{#each @model.errors.attributes.account_claim_maps as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + - \ No newline at end of file + diff --git a/ui/admin/app/components/form/auth-method/oidc/index.js b/ui/admin/app/components/form/auth-method/oidc/index.js new file mode 100644 index 000000000..4e4ac6f8b --- /dev/null +++ b/ui/admin/app/components/form/auth-method/oidc/index.js @@ -0,0 +1,17 @@ +import Component from '@glimmer/component'; +import { options } from 'api/models/auth-method'; + +export default class FormAuthMethodOidcComponent extends Component { + + // =attributes + /** + * @type {object} + */ + signingAlgorithms = options.oidc.signing_algorithms; + + /** + * @type {object} + */ + toClaims = options.oidc.account_claim_maps.to; + +}