@okta/okta-signin-widget
Version:
The Okta Sign-In Widget
299 lines (267 loc) • 12.7 kB
text/typescript
import Logger from 'util/Logger';
import { AUTHENTICATOR_KEY, FORMS as RemediationForms } from '../ion/RemediationConstants';
import { BaseView } from './internals';
// Identify
import IdentifierView from './views/IdentifierView';
import RedirectIdPView from './views/RedirectIdPView';
import IdentifyRecoveryView from './views/IdentifyRecoveryView';
// Terminal & Auto-Redirect
import TerminalView from './views/TerminalView';
import AutoRedirectView from './views/AutoRedirectView';
// safe mode poll view
import PollView from './views/PollView';
// consent
import AdminConsentView from './views/consent/AdminConsentView';
import EnduserConsentView from './views/consent/EnduserConsentView';
import GranularConsentView from './views/consent/GranularConsentView';
import EnduserEmailConsentView from './views/consent/EnduserEmailConsentView';
// Device (Okta Verify)
import DeviceChallengePollView from './views/device/DeviceChallengePollView';
import SSOExtensionView from './views/device/SSOExtensionView';
import SignInDeviceView from './views/device/SignInDeviceView';
import DeviceEnrollmentTerminalView from './views/device/DeviceEnrollmentTerminalView';
// registration
import EnrollProfileView from './views/EnrollProfileView';
// registration update
import EnrollProfileUpdateView from './views/EnrollProfileUpdateView';
// Email Activation
import RequestActivationEmail from './views/activation/RequestActivationEmailView';
// authenticator list
import SelectAuthenticatorEnrollView from './views/SelectAuthenticatorEnrollView';
import SelectAuthenticatorVerifyView from './views/SelectAuthenticatorVerifyView';
import SelectAuthenticatorUnlockAccountView from './views/authenticator/SelectAuthenticatorUnlockAccountView';
// password
import EnrollAuthenticatorPasswordView from './views/password/EnrollAuthenticatorPasswordView';
import ChallengeAuthenticatorPasswordView from './views/password/ChallengeAuthenticatorPasswordView';
import ReEnrollAuthenticatorPasswordView from './views/password/ReEnrollAuthenticatorPasswordView';
import ReEnrollAuthenticatorWarningPasswordView from './views/password/ReEnrollAuthenticatorWarningPasswordView';
import ResetAuthenticatorPasswordView from './views/password/ResetAuthenticatorPasswordView';
// phone
import EnrollAuthenticatorPhoneView from './views/phone/EnrollAuthenticatorPhoneView';
import EnrollAuthenticatorDataPhoneView from './views/phone/EnrollAuthenticatorDataPhoneView';
import ChallengeAuthenticatorPhoneView from './views/phone/ChallengeAuthenticatorPhoneView';
import ChallengeAuthenticatorDataPhoneView from './views/phone/ChallengeAuthenticatorDataPhoneView';
// security question
import EnrollAuthenticatorSecurityQuestion from './views/security-question/EnrollAuthenticatorSecurityQuestionView';
import ChallengeAuthenticatorSecurityQuestion from './views/security-question/ChallengeAuthenticatorSecurityQuestion';
//webauthn
import EnrollWebauthnView from './views/webauthn/EnrollWebauthnView';
import ChallengeWebauthnView from './views/webauthn/ChallengeWebauthnView';
// email
import EnrollAuthenticatorEmailView from './views/email/EnrollAuthenticatorEmailView';
import ChallengeAuthenticatorEmailView from './views/email/ChallengeAuthenticatorEmailView';
import ChallengeAuthenticatorDataEmailView from './views/email/ChallengeAuthenticatorDataEmailView';
// app (okta verify)
import EnrollPollOktaVerifyView from './views/ov/EnrollPollOktaVerifyView';
import SelectEnrollmentChannelOktaVerifyView from './views/ov/SelectEnrollmentChannelOktaVerifyView';
import EnrollementChannelDataOktaVerifyView from './views/ov/EnrollementChannelDataOktaVerifyView';
import ChallengeOktaVerifyView from './views/ov/ChallengeOktaVerifyView';
import ChallengeOktaVerifyTotpView from './views/ov/ChallengeOktaVerifyTotpView';
import ChallengeOktaVerifyResendPushView from './views/ov/ChallengeOktaVerifyResendPushView';
import ChallengeOktaVerifyCustomAppDataView from './views/shared/ChallengeOktaVerifyCustomAppDataView';
import ChallengeOktaVerifySSOExtensionView from './views/ov/ChallengeOktaVerifySSOExtensionView';
// app (google authenticator)
import EnrollAuthenticatorGoogleAuthenticatorView from './views/google-authenticator/EnrollAuthenticatorGoogleAuthenticatorView';
import ChallengeGoogleAuthenticatorView from './views/google-authenticator/ChallengeGoogleAuthenticatorView';
// on-prem mfa
import EnrollAuthenticatorOnPremView from './views/on-prem/EnrollAuthenticatorOnPremView';
import ChallengeAuthenticatorOnPremView from './views/on-prem/ChallengeAuthenticatorOnPremView';
// duo mfa
import EnrollDuoAuthenticatorView from './views/duo/EnrollDuoAuthenticatorView';
import ChallengeDuoAuthenticatorView from './views/duo/ChallengeDuoAuthenticatorView';
// idp authenticator
import AuthenticatorIdPVerifyView from './views/idp/AuthenticatorIdPVerifyView';
import AuthenticatorIdPEnrollView from './views/idp/AuthenticatorIdPEnrollView';
// custom otp
import ChallengeCustomOTPAuthenticatorView from './views/custom-otp/ChallengeCustomOTPAuthenticatorView';
// Symantec VIP authenticator
import AuthenticatorSymantecView from './views/symantec/AuthenticatorSymantecView';
// Device code activate view
import DeviceCodeActivateView from './views/device/DeviceCodeActivateView';
// X509 PIV view
import ChallengePIVView from './views/piv/ChallengePIVView';
// YubiKey
import AuthenticatorYubiKeyView from './views/yubikey/AuthenticatorYubiKeyView';
// custom app
import ChallengePushView from './views/shared/ChallengePushView';
import ChallengeCustomAppResendPushView from './views/custom-app/ChallengeCustomAppResendPushView';
// custom password
import ReEnrollCustomPasswordExpiryView from './views/custom-password/ReEnrollCustomPasswordExpiryView';
import ReEnrollCustomPasswordExpiryWarningView from './views/custom-password/ReEnrollCustomPasswordExpiryWarningView';
// keep me signed in
import PostAuthKeepMeSignedInView from './views/keep-me-signed-in/PostAuthKeepMeSignedInView';
const DEFAULT = '_';
const VIEWS_MAPPING = {
[ ]: {
[ ]: IdentifierView,
},
[ ]: {
[ ]: IdentifyRecoveryView,
},
[ ]: {
[ ]: DeviceChallengePollView,
},
[ ]: {
[ ]: SignInDeviceView,
},
[ ]: {
[ ]: SSOExtensionView,
[ ]: ChallengeOktaVerifySSOExtensionView,
},
[ ]: {
[ ]: SSOExtensionView,
},
[ ]: {
[ ]: EnrollProfileView,
},
[ ]: {
[ ]: EnrollProfileUpdateView,
},
[ ]: {
[ ]: PollView
},
[ ]: {
[ ]: RequestActivationEmail
},
[ ]: {
[ ]: SelectAuthenticatorEnrollView,
},
[ ]: {
[ ]: EnrollAuthenticatorDataPhoneView,
[ ]: ChallengeAuthenticatorDataEmailView,
},
[ ]: {
[ ]: AdminConsentView
},
[ ]: {
[ ]: EnduserConsentView
},
[ ]: {
[ ]: GranularConsentView
},
[ ]: {
[ ]: EnduserEmailConsentView,
},
[ ]: {
[ ]: EnrollDuoAuthenticatorView,
[ ]: EnrollAuthenticatorEmailView,
[ ]: EnrollAuthenticatorGoogleAuthenticatorView,
[ ]: AuthenticatorIdPEnrollView,
[ ]: EnrollAuthenticatorOnPremView,
[ ]: EnrollAuthenticatorPasswordView,
[ ]: EnrollAuthenticatorPhoneView,
[ ]: EnrollAuthenticatorOnPremView,
[ ]: EnrollAuthenticatorSecurityQuestion,
[ ]: AuthenticatorSymantecView,
[ ]: EnrollWebauthnView,
[ ]: AuthenticatorYubiKeyView,
},
[ ]: {
[ ]: ChallengeCustomOTPAuthenticatorView,
[ ]: ChallengeDuoAuthenticatorView,
[ ]: ChallengeAuthenticatorEmailView,
[ ]: ChallengeGoogleAuthenticatorView,
[ ]: AuthenticatorIdPVerifyView,
[ ]: ChallengeAuthenticatorOnPremView,
[ ]: ChallengeOktaVerifyTotpView,
[ ]: ChallengeAuthenticatorPasswordView,
[ ]: ChallengeAuthenticatorPhoneView,
[ ]: ChallengeAuthenticatorOnPremView,
[ ]: ChallengeAuthenticatorSecurityQuestion,
[ ]: AuthenticatorSymantecView,
[ ]: ChallengeWebauthnView,
[ ]: AuthenticatorYubiKeyView,
},
[ ]: {
[ ]: EnrollPollOktaVerifyView,
},
[ ]: {
[ ]: SelectEnrollmentChannelOktaVerifyView,
},
[ ]: {
[ ]: EnrollementChannelDataOktaVerifyView,
},
// Expired scenarios for authenticators..
[ ]: {
// Password expired scenario..
[ ]: ReEnrollAuthenticatorPasswordView
},
[ ]: {
// Custom password expired scenario
[ ]: ReEnrollCustomPasswordExpiryView,
},
[ ]: {
// Custom password expiry warning scenario
[ ]: ReEnrollCustomPasswordExpiryWarningView,
},
// Will expire soon warnings for authenticators..
[ ]: {
// Password will expire soon scenario..
[ ]: ReEnrollAuthenticatorWarningPasswordView,
},
// Reset forms for authenticators..
[ ]: {
// Admin driven password reset..
[ ]: ResetAuthenticatorPasswordView,
[ ]: EnrollAuthenticatorGoogleAuthenticatorView,
},
[ ]: {
[ ]: SelectAuthenticatorVerifyView,
},
[ ]: {
[ ]: SelectAuthenticatorUnlockAccountView,
},
[ ]: {
[ ]: ChallengeOktaVerifyView,
[ ]: ChallengePushView,
},
[ ]: {
[ ]: ChallengeOktaVerifyResendPushView,
[ ]: ChallengeCustomAppResendPushView,
},
[ ]: {
[ ]: ChallengeAuthenticatorDataPhoneView,
[ ]: ChallengeOktaVerifyCustomAppDataView,
[ ]: ChallengeAuthenticatorDataEmailView,
[ ]: ChallengeOktaVerifyCustomAppDataView,
},
[ ]: {
[ ]: AutoRedirectView,
},
[ ]: {
[ ]: AutoRedirectView,
},
[ ]: {
[ ]: RedirectIdPView,
},
[ ]: {
[ ]: ChallengePIVView,
},
[ ]: {
[ ]: DeviceEnrollmentTerminalView,
},
[ ] : {
[ ] : DeviceCodeActivateView
},
[ ]: {
[ ]: PostAuthKeepMeSignedInView,
},
[ ]: {
[ ]: TerminalView,
},
};
export default {
create(formName, authenticatorKey = DEFAULT) {
const config = VIEWS_MAPPING[formName];
if (!config) {
Logger.warn(`Cannot find customized View for ${formName}.`);
return BaseView;
}
const View = config[authenticatorKey] || config[DEFAULT];
if (!View) {
Logger.warn(`Cannot find customized View for ${formName} + ${authenticatorKey}.`);
return BaseView;
}
return View;
}
};