mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2026-08-13 12:33:07 +02:00
Add Disable Authentication option in the frontend
This commit is contained in:
parent
bea43f211c
commit
b9fa4b2998
7 changed files with 9 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -103,7 +103,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
subscribe((action: (any)) => {
|
||||
if (action.type === RTLActions.SET_APPLICATION_SETTINGS) {
|
||||
if (!this.sessionService.getItem('token')) {
|
||||
if (+action.payload.SSO.rtlSSO) {
|
||||
if (!!action.payload.disableAuth) {
|
||||
this.store.dispatch(login({ payload: { password: 'disabledAuth', defaultPassword: false } }));
|
||||
} else if (+action.payload.SSO.rtlSSO) {
|
||||
if (!this.accessKey || this.accessKey.trim().length < 32) {
|
||||
this.router.navigate(['./error'], { state: { errorCode: '406', errorMessage: 'Access key too short. It should be at least 32 characters long.' } });
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ export class RTLConfiguration {
|
|||
public SSO: SSO,
|
||||
public enable2FA: boolean,
|
||||
public secret2FA: string,
|
||||
public disableAuth: boolean,
|
||||
public allowPasswordUpdate: boolean,
|
||||
public nodes: Node[]
|
||||
) { }
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ export enum AlertTypeEnum {
|
|||
}
|
||||
|
||||
export enum AuthenticateWith {
|
||||
NOAUTH = 'NOAUTH',
|
||||
JWT = 'JWT',
|
||||
PASSWORD = 'PASSWORD'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ export class RTLEffects implements OnDestroy {
|
|||
this.store.dispatch(resetECLStore());
|
||||
this.store.dispatch(updateRootAPICallStatus({ payload: { action: 'Login', status: APICallStatusEnum.INITIATED } }));
|
||||
return this.httpClient.post(API_END_POINTS.AUTHENTICATE_API, {
|
||||
authenticateWith: (!action.payload.password) ? AuthenticateWith.JWT : AuthenticateWith.PASSWORD,
|
||||
authenticateWith: (action.payload.password === 'disabledAuth') ? AuthenticateWith.NOAUTH : (!action.payload.password) ? AuthenticateWith.JWT : AuthenticateWith.PASSWORD,
|
||||
authenticationValue: (!action.payload.password) ? (this.sessionService.getItem('token') ? this.sessionService.getItem('token') : '') : action.payload.password,
|
||||
twoFAToken: (action.payload.twoFAToken) ? action.payload.twoFAToken : ''
|
||||
}).pipe(
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export const initRootState: RootState = {
|
|||
SSO: { rtlSSO: 0, logoutRedirectLink: '' },
|
||||
enable2FA: false,
|
||||
secret2FA: '',
|
||||
disableAuth: false,
|
||||
allowPasswordUpdate: true,
|
||||
nodes: [{ settings: initNodeSettings, authentication: initNodeAuthentication }]
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue