diff --git a/changelog/_9394.txt b/changelog/_9394.txt new file mode 100644 index 0000000000..5f24f42567 --- /dev/null +++ b/changelog/_9394.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui/auth: the role field on the SAML login form now auto-fills from the `role` URL query string parameter +``` diff --git a/ui/app/components/auth/form/saml.hbs b/ui/app/components/auth/form/saml.hbs index 05f9fe78f1..b5445f71f9 100644 --- a/ui/app/components/auth/form/saml.hbs +++ b/ui/app/components/auth/form/saml.hbs @@ -14,7 +14,7 @@ {{! Authenticating with SAML requires a secure context }} {{#if this.canLoginSaml}} - + {{yield to="advancedSettings"}} diff --git a/ui/tests/acceptance/auth/auth-login-test.js b/ui/tests/acceptance/auth/auth-login-test.js index bc57c07110..84629a13f8 100644 --- a/ui/tests/acceptance/auth/auth-login-test.js +++ b/ui/tests/acceptance/auth/auth-login-test.js @@ -61,6 +61,13 @@ module('Acceptance | auth login', function (hooks) { assert.dom(GENERAL.inputByAttr('role')).hasValue(role); }); + test('enterprise: it pre-fills SAML role if specified in query param', async function (assert) { + const role = AUTH_METHOD_LOGIN_DATA.oidc.role; + await visit(`/vault/auth?with=saml&role=${role}`); + assert.dom(AUTH_FORM.selectMethod).hasValue('saml'); + assert.dom(GENERAL.inputByAttr('role')).hasValue(role); + }); + test('it selects auth method if "with" query param ends in an encoded slash and matches an auth type', async function (assert) { await visit('/vault/auth?with=userpass%2F'); assert.dom(AUTH_FORM.selectMethod).hasValue('userpass');