feat: pre-fill SAML login role from URL (#9394) (#9402)

* prefill role for saml auth method

* add changelog

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
This commit is contained in:
Vault Automation 2025-09-17 14:16:57 -04:00 committed by GitHub
parent dfc8b589be
commit cc9e227d0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

3
changelog/_9394.txt Normal file
View file

@ -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
```

View file

@ -14,7 +14,7 @@
{{! Authenticating with SAML requires a secure context }}
{{#if this.canLoginSaml}}
<Auth::Fields @loginFields={{this.loginFields}} />
<Auth::Fields @loginFields={{this.loginFields}} @formQueryParams={{@formQueryParams}} />
{{yield to="advancedSettings"}}

View file

@ -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');