From bdf9c4efd569466b3e55e08e7efc42d23f5a5e03 Mon Sep 17 00:00:00 2001 From: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:49:27 -0700 Subject: [PATCH] UI: Smoke test and add mfa validation support for standard methods (#30424) * =VAULT-34544 userpass * update args for okta and oidc-jwt * add todo * VAULT-34551 tested github login * VAULT-34550 tested radius login * VAULT-34545 tested ldap login * test token --- ui/app/components/auth/form/base.ts | 6 +++--- ui/app/components/auth/form/{github.js => github.ts} | 0 ui/app/components/auth/form/{ldap.js => ldap.ts} | 0 ui/app/components/auth/form/oidc-jwt.ts | 4 +++- ui/app/components/auth/form/okta.ts | 2 +- ui/app/components/auth/form/{radius.js => radius.ts} | 0 ui/app/components/auth/form/{token.js => token.ts} | 0 ui/app/components/auth/form/{userpass.js => userpass.ts} | 2 +- 8 files changed, 8 insertions(+), 6 deletions(-) rename ui/app/components/auth/form/{github.js => github.ts} (100%) rename ui/app/components/auth/form/{ldap.js => ldap.ts} (100%) rename ui/app/components/auth/form/{radius.js => radius.ts} (100%) rename ui/app/components/auth/form/{token.js => token.ts} (100%) rename ui/app/components/auth/form/{userpass.js => userpass.ts} (93%) diff --git a/ui/app/components/auth/form/base.ts b/ui/app/components/auth/form/base.ts index 68b473fa56..bc15b31107 100644 --- a/ui/app/components/auth/form/base.ts +++ b/ui/app/components/auth/form/base.ts @@ -57,16 +57,16 @@ export default class AuthBase extends Component { selectedAuth: this.args.authType, }); - this.handleAuthResponse(authResponse); + this.handleAuthResponse(authResponse, this.args.authType, formData); } catch (error) { this.onError(error as Error); } }) ); - handleAuthResponse(authResponse: AuthData) { + handleAuthResponse(authResponse: AuthData, authType: string, formData?: object) { // calls onAuthResponse in parent auth/page.js component - this.args.onSuccess(authResponse); + this.args.onSuccess(authResponse, authType, formData); } onError(error: Error | string) { diff --git a/ui/app/components/auth/form/github.js b/ui/app/components/auth/form/github.ts similarity index 100% rename from ui/app/components/auth/form/github.js rename to ui/app/components/auth/form/github.ts diff --git a/ui/app/components/auth/form/ldap.js b/ui/app/components/auth/form/ldap.ts similarity index 100% rename from ui/app/components/auth/form/ldap.js rename to ui/app/components/auth/form/ldap.ts diff --git a/ui/app/components/auth/form/oidc-jwt.ts b/ui/app/components/auth/form/oidc-jwt.ts index 971355ffce..76d141761b 100644 --- a/ui/app/components/auth/form/oidc-jwt.ts +++ b/ui/app/components/auth/form/oidc-jwt.ts @@ -137,6 +137,7 @@ export default class AuthFormOidcJwt extends AuthBase { async continueLogin(data: JwtLoginData | OidcLoginData) { try { + // TODO backend should probably be path, but holding off refactor since api service may remove need all together // OIDC callback returns a token so authenticate with that const backend = this.isOIDC && 'token' in data ? 'token' : this.args.authType; @@ -146,8 +147,9 @@ export default class AuthFormOidcJwt extends AuthBase { data, selectedAuth: this.args.authType, }); + // responsible for redirect after auth data is persisted - this.handleAuthResponse(authResponse); + this.handleAuthResponse(authResponse, this.args.authType); } catch (error) { this.onError(error as Error); } diff --git a/ui/app/components/auth/form/okta.ts b/ui/app/components/auth/form/okta.ts index abd0199f8e..6672db681b 100644 --- a/ui/app/components/auth/form/okta.ts +++ b/ui/app/components/auth/form/okta.ts @@ -45,7 +45,7 @@ export default class AuthFormOkta extends AuthBase { selectedAuth: this.args.authType, }); - this.handleAuthResponse(authResponse); + this.handleAuthResponse(authResponse, this.args.authType); } catch (error) { // if a user fails the okta verify challenge, the POST login request fails (made by this.auth.authenticate above) // bubble those up for consistency instead of managing error state in this component diff --git a/ui/app/components/auth/form/radius.js b/ui/app/components/auth/form/radius.ts similarity index 100% rename from ui/app/components/auth/form/radius.js rename to ui/app/components/auth/form/radius.ts diff --git a/ui/app/components/auth/form/token.js b/ui/app/components/auth/form/token.ts similarity index 100% rename from ui/app/components/auth/form/token.js rename to ui/app/components/auth/form/token.ts diff --git a/ui/app/components/auth/form/userpass.js b/ui/app/components/auth/form/userpass.ts similarity index 93% rename from ui/app/components/auth/form/userpass.js rename to ui/app/components/auth/form/userpass.ts index d6c00e08bd..de28d0243a 100644 --- a/ui/app/components/auth/form/userpass.js +++ b/ui/app/components/auth/form/userpass.ts @@ -7,7 +7,7 @@ import AuthBase from './base'; /** * @module Auth::Form::Userpass - * + * see Auth::Base * */ export default class AuthFormUserpass extends AuthBase {