Remove defaultAuthStatus from all environment configurations.
This commit is contained in:
parent
de1876c90c
commit
da17cf9696
|
|
@ -2,7 +2,6 @@ import {Injectable} from '@angular/core';
|
|||
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
|
||||
import {Observable} from 'rxjs';
|
||||
import {AuthService} from '@services/auth.service';
|
||||
import {environment} from '@environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
@ -19,9 +18,6 @@ export class AuthGuard implements CanActivate {
|
|||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
if (environment.defaultAuthStatus) {
|
||||
return true;
|
||||
}
|
||||
if (!this.authService.checkAuthStatus()) {
|
||||
return this.router.createUrlTree(['/']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,19 +5,18 @@ import {catchError, tap} from 'rxjs/operators';
|
|||
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||
import {JwtHelperService} from '@auth0/angular-jwt';
|
||||
import {JwtClaims} from '@custom-types/jwt_interface'
|
||||
import {environment} from '@environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthService {
|
||||
private isAuthenticatedSubject = new BehaviorSubject<boolean>(environment.defaultAuthStatus);
|
||||
private isAuthenticatedSubject = new BehaviorSubject<boolean>(false);
|
||||
public isAuthenticated$ = this.isAuthenticatedSubject.asObservable();
|
||||
|
||||
private userClaimsSubject = new BehaviorSubject<JwtClaims | null>(null);
|
||||
public userClaims$ = this.userClaimsSubject.asObservable();
|
||||
private jwtHelper = new JwtHelperService();
|
||||
private _username = signal<string | null>(environment.defaultAuthStatus ? 'akastijn' : null);
|
||||
private _username = signal<string | null>(null);
|
||||
public readonly username = this._username.asReadonly();
|
||||
|
||||
constructor(
|
||||
|
|
@ -136,9 +135,6 @@ export class AuthService {
|
|||
}
|
||||
|
||||
public getUuid(): string | null {
|
||||
if (environment.defaultAuthStatus) {
|
||||
return '55e46bc3-2a29-4c53-850f-dbd944dc5c5f';
|
||||
}
|
||||
const jwtClaims = this.userClaimsSubject.getValue();
|
||||
if (jwtClaims === null) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://beta.alttd.com',
|
||||
defaultAuthStatus: false
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export const environment = {
|
||||
production: false,
|
||||
apiUrl: 'http://localhost:8080',
|
||||
defaultAuthStatus: true
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://alttd.com',
|
||||
defaultAuthStatus: false
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://alttd.com',
|
||||
defaultAuthStatus: false
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user