core/login/login.service.ts
Service to manage the login.
Properties |
Methods |
|
constructor(injector: Injector, client: FetchClient, basicAuth: BasicAuth, cookieAuth: CookieAuth, ui: AppStateService, user: UserService, tenant: TenantService, realtime: Realtime, alert: AlertService, api: ApiService, tenantUiService: TenantUiService, tenantLoginOptionsService: TenantLoginOptionsService, translateService: TranslateService, modalService: ModalService, location: LocationStrategy)
|
||||||||||||||||||||||||||||||||||||||||||||||||
Parameters :
|
addSuccessMessage | ||||||||
addSuccessMessage(successKey: string)
|
||||||||
Adds a new success message
Parameters :
Returns :
void
|
Async authFulfilled | ||||||||||||
authFulfilled(tenant?, user?, supportUserName?)
|
||||||||||||
Saves tenant, user and support user info to the app state.
Parameters :
Returns :
any
|
autoLogout |
autoLogout()
|
Returns :
void
|
cleanMessages |
cleanMessages()
|
Clears all backend errors.
Returns :
void
|
Async generateOauthToken | ||||||
generateOauthToken(credentials?: ICredentials)
|
||||||
Parameters :
Returns :
unknown
|
Async getGreenMinLength |
getGreenMinLength()
|
Gets the minimal number of characters that a password should have to be considered a “green” strong one.
Returns :
unknown
The min length for password or default value. |
Async getPasswordStrengthEnforced | ||||||
getPasswordStrengthEnforced(options?)
|
||||||
Function determines if enforced strength checks should be enabled for current tenant based on properties retrieved from loginOptions
Parameters :
Returns :
unknown
boolean value, true if strength is enforced for tenant, false otherwise. |
Async getPasswordStrengthValidity | ||||||
getPasswordStrengthValidity(refresh?)
|
||||||
Checks if password strength is enforced for particular tenant
by retrieving value of
Parameters :
Returns :
unknown
boolean value, true if enforced, false otherwise. |
getTenant |
getTenant()
|
Returns the current tenant.
Returns :
any
The tenant name. |
initLoginOptions |
initLoginOptions()
|
Returns :
void
|
Async isPasswordGrantLogin | ||||||
isPasswordGrantLogin(credentials?: ICredentials)
|
||||||
Parameters :
Returns :
unknown
|
isSupportUser | ||||||||
isSupportUser(credentials?: ICredentials)
|
||||||||
Verifies if the provided credentials use a support user to log in or not.
Parameters :
Returns :
boolean
Returns true if user is a support user. |
Async login | |||||||||||||||
login(auth: IAuthentication, credentials?: ICredentials)
|
|||||||||||||||
Tries to login a user with the given credentials. If successful, the current tenant and user is set. If not an error is thrown. It also verifies if the user is allowed to open the current app.
Parameters :
Returns :
any
|
loginBySso |
loginBySso(sessionState: string, code: string)
|
Returns :
any
|
Async logout | ||||||||
logout(reload)
|
||||||||
Logs the user out
Parameters :
Returns :
any
|
redirectToDomain | ||||
redirectToDomain(domain)
|
||||
Parameters :
Returns :
void
|
redirectToOauth |
redirectToOauth()
|
Returns :
void
|
Async reset |
reset()
|
Resets the stored auth-data
Returns :
unknown
|
saveTFAToken | ||||||||||||
saveTFAToken(tfaToken: string, storage: Storage)
|
||||||||||||
Saves the TFA token to local or session storage.
Parameters :
Returns :
void
|
showSsoError | ||||
showSsoError(error)
|
||||
Parameters :
Returns :
void
|
showTenant |
showTenant()
|
Verifies if the tenant input field should be shown or not.
Returns :
boolean
If true, show the tenant input. |
showTenantSetup |
showTenantSetup()
|
Verifies if the tenant setup should be shown or not.
Returns :
boolean
If true, show the tenant input. |
Async switchLoginMode | ||||||||
switchLoginMode(credentials?: ICredentials)
|
||||||||
Switch the login mode to CookieAuth if the user has configured to use it in loginOptions.
Parameters :
Returns :
unknown
|
useBasicAuth | ||||||||
useBasicAuth(credentials: ICredentials)
|
||||||||
Forces the use of basic auth as strategy with this credentials.
Parameters :
Returns :
BasicAuth
|
Async verifyAppAccess |
verifyAppAccess()
|
Request the manifest -> on 401 user has no access to that application and we throw the error up to the login form.
Returns :
any
|
automaticLoginInProgress$ |
Default value : new BehaviorSubject(false)
|
ERROR_MESSAGES |
Type : object
|
Default value : {
minlength: gettext('Password must have at least 8 characters and no more than 32.'),
password_missmatch: gettext('Passwords do not match.'),
maxlength: gettext('Password must have at least 8 characters and no more than 32.'),
password_strength: gettext(
'Your password is not strong enough. Please include numbers, lower and upper case characters'
),
remote_error: gettext('Server error occurred.'),
email: gettext('Invalid email address.'),
password_change: gettext('Your password is expired. Please set a new password.'),
password_reset_token_expired: gettext(
'Password reset link expired. Please enter your email address to receive a new one.'
),
tfa_pin_invalid: gettext('The code you entered is invalid. Please try again.'),
pattern_newPassword: this.translateService.instant(
gettext(
'Password must have at least 8 characters and no more than 32 and can only contain letters, numbers and following symbols: {{ symbols }}'
),
{ symbols: '`~!@#$%^&*()_|+-=?;:\'",.<>{}[]\\/' }
),
internationalPhoneNumber: gettext(
'Must be a valid phone number (only digits, spaces, slashes ("/"), dashes ("-"), and plus ("+") allowed, for example: +49 9 876 543 210).'
),
phone_number_error: gettext('Could not update phone number.'),
pinAlreadySent: gettext(
'The verification code was already sent. For a new verification code, please click on the link above.'
),
passwordConfirm: gettext('Passwords do not match.'),
tfaExpired: gettext('Two-factor authentication token expired.')
}
|
GREEN_MIN_LENGTH_DEFAULT |
Type : number
|
Default value : 8
|
isFirstLogin |
Default value : true
|
loginMode |
Type : ITenantLoginOption
|
managementLoginMode |
Type : ITenantLoginOption
|
oauthOptions |
Type : ITenantLoginOption
|
rememberMe |
Default value : false
|
TFATOKEN_KEY |
Type : string
|
Default value : 'TFAToken'
|
TOKEN_KEY |
Type : string
|
Default value : '_tcy8'
|