diff --git a/.changelog/11979.txt b/.changelog/11979.txt new file mode 100644 index 0000000000..8ef0e855b1 --- /dev/null +++ b/.changelog/11979.txt @@ -0,0 +1,4 @@ +```release-note:bug +ui: Ensure partition query parameter is passed through to all OIDC related API +requests +``` diff --git a/ui/packages/consul-ui/app/components/auth-form/index.hbs b/ui/packages/consul-ui/app/components/auth-form/index.hbs index 3578e467d1..b9ba008f99 100644 --- a/ui/packages/consul-ui/app/components/auth-form/index.hbs +++ b/ui/packages/consul-ui/app/components/auth-form/index.hbs @@ -154,7 +154,7 @@ as |TabState IgnoredGuard IgnoredAction tabDispatch tabState|> @nspace={{or this.value.Namespace @nspace}} @partition={{or this.value.Partition @partition}} @type={{if this.value.Name 'oidc' 'secret'}} - @value={{if this.value.Name this.value.Name this.value}} + @value={{this.value}} @onchange={{queue (action dispatch "RESET") @onsubmit}} @onerror={{queue (action (mut this.error) value="error.errors.firstObject") (action dispatch "ERROR")}} /> diff --git a/ui/packages/consul-ui/app/components/token-source/README.mdx b/ui/packages/consul-ui/app/components/token-source/README.mdx index 8a451f2c83..186cba5d4f 100644 --- a/ui/packages/consul-ui/app/components/token-source/README.mdx +++ b/ui/packages/consul-ui/app/components/token-source/README.mdx @@ -21,6 +21,15 @@ This component **does not store the resulting token**, it only emits it via its `onchange` argument/event handler. Errors are emitted via the `onerror` argument/event handler. +## Potential improvements + +We could decide to remove the `@type` argument and always require an object +passed to `@value` instead of a `String|Object`. Alternatively we could still +allow `String|Object`. Then inside the component we could decide whether to +use the Consul or SSO depending on the shape of the `@value` argument. All in +all this means we can remove the `@type` argument making a slimmer component +API. + ```hbs preview-template
Provide a widget to login with
@@ -75,7 +84,7 @@ argument/event handler. | `nspace` | `String` | | The name of the current namespace | | `partition` | `String` | | The name of the current partition | | `type` | `String` | | `secret` or `oidc`. `secret` is just traditional login, whereas `oidc` uses the users OIDC provider | -| `value` | `String` | | When `type` is `secret` this should be the users secret. When `type` is `oidc` this should be the name of the `AuthMethod` to use for authentication | +| `value` | `String|Object` | | When `type` is `secret` this should be the users secret. When `type` is `oidc` this should be object returned by Consul's AuthMethod HTTP API endpoint | | `onchange` | `Function` | | The action to fire when the data changes. Emits an Event-like object with a `data` property containing the jwt data, in this case the autorizationCode and the status | | `onerror` | `Function` | | The action to fire when an error occurs. Emits ErrorEvent object with an `error` property containing the Error. | diff --git a/ui/packages/consul-ui/app/components/token-source/index.hbs b/ui/packages/consul-ui/app/components/token-source/index.hbs index 94186be1ba..962fc7774a 100644 --- a/ui/packages/consul-ui/app/components/token-source/index.hbs +++ b/ui/packages/consul-ui/app/components/token-source/index.hbs @@ -7,10 +7,10 @@ as |State Guard Action dispatch state|> @cond={{this.isSecret}} /> {{#let - (uri '/${partition}/{$nspace}/${dc}' + (uri '/${partition}/${nspace}/${dc}' (hash - partition=@partition - nspace=@nspace + partition=(or @value.Partition @partition) + nspace=(or @value.Namespace @nspace) dc=@dc ) ) @@ -30,7 +30,7 @@ as |State Guard Action dispatch state|>