-
Notifications
You must be signed in to change notification settings - Fork 4.4k
UI: Implement Auth::FormTemplate
#30521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Implement Auth::FormTemplate
#30521
Conversation
Build Results: |
CI Results: |
@@ -8,28 +8,26 @@ | |||
<h1 class="title is-4">MFA setup</h1> | |||
</:header> | |||
<:content> | |||
<div class="auth-form" data-test-mfa-form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/> | ||
{{/if}} | ||
</div> | ||
<div class="has-padding-l" data-test-mfa-form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2,9 +2,9 @@ | |||
Copyright (c) HashiCorp, Inc. | |||
SPDX-License-Identifier: BUSL-1.1 | |||
}} | |||
{{! todo move to auth/ folder? }} | |||
<div class="auth-form" data-test-okta-number-challenge> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class="auth-form" data-test-okta-number-challenge> | ||
<div class="box is-marginless is-shadowless"> | ||
|
||
<Hds::Card::Container @level="high" @hasBorder={{true}} class="overflow-auto" data-test-okta-number-challenge> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make comment make more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting close! Few questions/comments and noticed some commented out code but nothing blocking.
<div class="splash-page-sub-header" data-test-splash-page-sub-header> | ||
{{yield to="subHeader"}} | ||
</div> | ||
<div class="login-form box is-paddingless is-relative" data-test-splash-page-content> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall this was to accomodate something with MFA? Did it move to the component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! The subHeader
is where the namespace input rendered, which now renders in the Auth::FormTemplate
vault/ui/app/components/auth/form-template.hbs
Lines 18 to 23 in e77f206
<Auth::NamespaceInput | |
@disabled={{@oidcProviderQueryParam}} | |
@hvdManagedNamespace={{this.flags.hvdManagedNamespaceRoot}} | |
@namespaceValue={{this.namespaceInput}} | |
@updateNamespace={{this.handleNamespaceUpdate}} | |
/> |
And then the content div
on 15 is just replaced with the Hds::Card::Container
to update the css with the rounded edges. This removes the need for the login-form
css class and replaces it with overflow-auto
class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yes that's right. I must have been thinking of something else related to MFA. Nice to remove that block since it was only used for the one case!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also the mfa setup steps here - I wonder if that's what you were thinking of π€ Hopefully I didn't miss anything π
test('allows password reset for userpass users logged in via tab', async function (assert) { | ||
await login(); | ||
await runCmd([ | ||
mountAuthCmd('userpass', this.userpass), | ||
`write sys/auth/${this.userpass}/tune listing_visibility="unauth"`, | ||
createPolicyCmd(this.userpass, this.policy), | ||
`write auth/${this.userpass}/users/reset-me password=password token_policies=${this.userpass}`, | ||
]); | ||
await logout(); | ||
await click(`[data-test-auth-method="${this.userpass}"] a`); | ||
await fillIn(GENERAL.inputByAttr('username'), 'reset-me'); | ||
await fillIn(GENERAL.inputByAttr('password'), 'password'); | ||
await click(AUTH_FORM.login); | ||
|
||
await click('[data-test-user-menu-trigger]'); | ||
await click('[data-test-user-menu-item="reset-password"]'); | ||
|
||
assert.strictEqual(currenturl(""), '/vault/access/reset-password', 'links to password reset'); | ||
assert | ||
.dom('[data-test-current-user-banner]') | ||
.hasText( | ||
`You are updating the password for reset-me on the ${this.userpass} auth mount.`, | ||
'shows correct banner text' | ||
); | ||
|
||
assert.dom('[data-test-title]').hasText('Reset password', 'page title'); | ||
await fillIn('[data-test-input="reset-password"]', 'newpassword'); | ||
await click('[data-test-reset-password-save]'); | ||
await waitFor('[data-test-flash-message]'); | ||
assert.dom('[data-test-flash-message]').hasText(`Success ${SUCCESS_MESSAGE}`); | ||
assert.dom('[data-test-input="reset-password"]').hasValue('', 'Resets input after save'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this no longer relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I meant to leave a comment. Now tabs vs dropdown are just a stylistic difference but functionally work the same, so there's no need to test logging in from a tab.
Plus configuring an auth method with listing_visibility="unauth"
messes up the test server state since any tests that run after fail to login()
since the tab view shows instead of the default login form. It felt more reliable to remove any logic that actually configured methods with that setting than having to check the login form state for each test or make sure that the appropriate cleanup (deleting the mount) happened
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good thanks for the context!
83ab135
into
VAULT-35470/wire-up-accessible-auth-components
* UI: Move `wrapped_token` login functionality to route (#30465) * move token unwrap functionality to page component * update mfa test * remove wrapped_token logic from page component * more cleanup to relocate unwrap logic * move wrapped_token to route * move unwrap tests to acceptance * move mfa form back * add some padding * update mfa-form tests * get param from params * wait for auth form on back * run rests * UI: Add MFA support for SSO methods (#30489) * initial implementation of mfa validation for sso methods * update typescript interfaces * add stopgap changes to auth service * switch order backend is defined * update login form for tests even though it will be deleted * attempt to stabilize wrapped_query test * =update login form test why not * Update ui/app/components/auth/form/saml.ts Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com> --------- Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com> * Move CSP error to page component (#30492) * initial implementation of mfa validation for sso methods * update typescript interfaces * add stopgap changes to auth service * switch order backend is defined * update login form for tests even though it will be deleted * attempt to stabilize wrapped_query test * =update login form test why not * move csp error to page component * move csp error to page component * Move fetching unauthenticated mounts to the route (#30509) * rename namespace arg to namespaceQueryParam * move fetch mounts to route * add margin to sign in button spacing * update selectors for oidc provider test * add todo delete comments * fix arg typo in test * change method name * fix args handling tab click * remove tests that no longer relate to components functionality * add tests for preselectedAuthType functionality * move typescript interfaces, fix selector * add await * oops * move format method down, make private * move tab formatting to the route * move to page object * fix token unwrap aborting transition * not sure what that is doing there.. * add comments * rename to presetAuthType * use did-insert instead * UI: Implement `Auth::FormTemplate` (#30521) * replace Auth::LoginForm with Auth::FormTemplate * first round of test updates * return null if mounts object is empty * add comment and test for empty sys/internal/mounts data * more test updates * delete listing_visibility test, delete login-form component test * update divs to Hds::Card::Container * add overflow class * remove unused getters * move requesting stored auth type to page component * fix typo * Update ui/app/components/auth/form/oidc-jwt.ts make comment make more sense * small cleanup items, update imports * Delete old auth components (#30527) * delete old components * update codeowners * Update `with` query param functionality (#30537) * update path input to type=hidden * add test coverage * update page test * update auth route * delete login form * update ent test * consolidate logic in getter * add more comments * more comments.. * rename selector * refresh model as well * redirect for invalid query params * move unwrap to redirect * only redirect on invalid query params * add tests for query param * test selector updates * remove todos, update relevant ones with initials * add changelog --------- Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com>
Description
π Finally π implements new accessible auth form components.
β enterprise pass
listing_visibility="unauth"
used to set visible mounts paths as tabsTODO only if you're a HashiCorp employee
backport/
label that matches the desired release branch. Note that in the CE repo, the latest release branch will look likebackport/x.x.x
, but older release branches will bebackport/ent/x.x.x+ent
.of a public function, even if that change is in a CE file, double check that
applying the patch for this PR to the ENT repo and running tests doesn't
break any tests. Sometimes ENT only tests rely on public functions in CE
files.
in the PR description, commit message, or branch name.
description. Also, make sure the changelog is in this PR, not in your ENT PR.