Skip to content

Commit 1354afe

Browse files
author
Bernardo-MG
committed
Cleaned up code
1 parent 27924c5 commit 1354afe

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/app/core/authentication/guard/logged-in.guard.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import { SecurityContainer } from '../services/security-container.service';
1212
})
1313
export class LoggedInGuard implements CanActivate {
1414

15-
private loginUrl = '/login';
15+
/**
16+
* Login form route.
17+
*/
18+
private loginRoute = '/login';
1619

1720
constructor(
1821
private router: Router,
@@ -31,7 +34,7 @@ export class LoggedInGuard implements CanActivate {
3134
} else {
3235
// Not logged in
3336
// Redirect to login
34-
this.router.navigate([this.loginUrl], { queryParams: { returnUrl: state.url } });
37+
this.router.navigate([this.loginRoute], { queryParams: { returnUrl: state.url } });
3538
active = false;
3639
}
3740

src/app/core/authentication/guard/logged-out.guard.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import { SecurityContainer } from '../services/security-container.service';
1212
})
1313
export class LoggedOutGuard implements CanActivate {
1414

15-
private homeUrl = '/';
15+
/**
16+
* Application home route.
17+
*/
18+
private homeRoute = '/';
1619

1720
constructor(
1821
private router: Router,
@@ -29,7 +32,7 @@ export class LoggedOutGuard implements CanActivate {
2932
// Logged in
3033
// Redirect to home
3134
active = false;
32-
this.router.navigate([this.homeUrl]);
35+
this.router.navigate([this.homeRoute]);
3336
} else {
3437
// Not logged in
3538
active = true;

src/app/core/authentication/interceptor/basic-authentication.interceptor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ import { SecurityContainer } from '../services/security-container.service';
1111
@Injectable()
1212
export class BasicAuthenticationInterceptor implements HttpInterceptor {
1313

14+
/**
15+
* Token header for the authentication details.
16+
*/
1417
private tokenHeaderKey = 'Authorization';
1518

19+
/**
20+
* Authentication type identifier.
21+
*/
1622
private tokenHeaderIdentifier = 'Basic'
1723

1824
constructor(

0 commit comments

Comments
 (0)