feat: remove unused branding component from callback, update authentication service to handle missing issuer in configuration
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
<div class="blank-layout-container justify-content-center">
|
|
||||||
<div class="position-relative row w-100 h-100">
|
|
||||||
<div class="col-lg-8 col-xl-9 bg-gredient p-0">
|
|
||||||
<div class="p-24 h-100">
|
|
||||||
<app-branding></app-branding>
|
|
||||||
|
|
||||||
<div class="align-items-center justify-content-center img-height d-none d-lg-flex">
|
|
||||||
<img src="/assets/images/backgrounds/login-bg.svg" alt="login" style="max-width: 500px" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-4 col-xl-3 p-0 d-flex justify-content-center">
|
|
||||||
<div class="p-32 d-flex align-items-start align-items-lg-center h-100 max-width-form justify-content-center">
|
|
||||||
<div>
|
|
||||||
<h4 class="f-w-700 f-s-20 m-0">Authentikácia úspešná!</h4>
|
|
||||||
@if(!profile) {
|
|
||||||
<span class="f-s-14 d-block f-s-14 m-t-24">Načítavam Vaše údaje...</span>
|
|
||||||
}
|
|
||||||
@else{
|
|
||||||
<span class="f-s-14 d-block f-s-14 m-t-24">{{profile.email}}</span>
|
|
||||||
<img [src]="profile.picture" alt="profile picture" width="100" class="m-t-16 rounded-circle" />
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -2,13 +2,12 @@ import { Component } from '@angular/core';
|
|||||||
import { Router, RouterModule } from '@angular/router';
|
import { Router, RouterModule } from '@angular/router';
|
||||||
import { CoreService } from '../../../services/core.service';
|
import { CoreService } from '../../../services/core.service';
|
||||||
import { MaterialModule } from '../../../material.module';
|
import { MaterialModule } from '../../../material.module';
|
||||||
import { BrandingComponent } from '../../../layouts/full/vertical/sidebar/branding.component';
|
|
||||||
import { AuthenticationService } from '../../../services/authentication.service';
|
import { AuthenticationService } from '../../../services/authentication.service';
|
||||||
import { NgScrollbarModule } from "ngx-scrollbar";
|
import { NgScrollbarModule } from "ngx-scrollbar";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-callback',
|
selector: 'app-callback',
|
||||||
imports: [RouterModule, MaterialModule, BrandingComponent, NgScrollbarModule],
|
imports: [RouterModule, MaterialModule, NgScrollbarModule],
|
||||||
templateUrl: './callback.component.html',
|
templateUrl: './callback.component.html',
|
||||||
})
|
})
|
||||||
export class CallbackComponent {
|
export class CallbackComponent {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<app-branding></app-branding>
|
<app-branding></app-branding>
|
||||||
|
|
||||||
<div class="align-items-center justify-content-center img-height d-none d-lg-flex">
|
<div class="align-items-center justify-content-center img-height d-none d-lg-flex">
|
||||||
<img src="/assets/images/backgrounds/login-bg.svg" alt="login" style="max-width: 500px" />
|
<img src="/assets/images/backgrounds/login-bg.svg" alt="prihlásenie" style="max-width: 500px" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
<div class="p-32 d-flex align-items-start align-items-lg-center justify-content-center h-100">
|
<div class="p-32 d-flex align-items-start align-items-lg-center justify-content-center h-100">
|
||||||
<div class="row justify-content-center w-100">
|
<div class="row justify-content-center w-100">
|
||||||
<div class="col-lg-9 max-width-form">
|
<div class="col-lg-9 max-width-form">
|
||||||
<h4 class="f-w-700 f-s-24 m-0">Signed out</h4>
|
<h4 class="f-w-700 f-s-24 m-0">Odhlásenie</h4>
|
||||||
<span class="f-s-14 d-block f-s-14 m-t-8">You have beens successfully logged out.</span>
|
<span class="f-s-14 d-block f-s-14 m-t-8">Úspešne ste sa odhlásili.</span>
|
||||||
|
|
||||||
<div class="row m-t-24 align-items-center">
|
<div class="row m-t-24 align-items-center">
|
||||||
<a [routerLink]="['/authentication/login']" mat-flat-button color="primary"
|
<a [routerLink]="['/authentication/login']" mat-flat-button color="primary"
|
||||||
class="w-100">
|
class="w-100">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
Prihlásenie
|
Prihlásiť sa
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
import { AuthConfig, OAuthService } from 'angular-oauth2-oidc';
|
import { AuthConfig, OAuthService } from 'angular-oauth2-oidc';
|
||||||
|
|
||||||
const CONFIG_KEY = 'oauth_config_v1';
|
const CONFIG_KEY = 'oauth_config_v1';
|
||||||
@@ -17,7 +18,7 @@ export class AuthenticationService {
|
|||||||
|
|
||||||
public profile: any = null;
|
public profile: any = null;
|
||||||
|
|
||||||
constructor(private oauthService: OAuthService) { }
|
constructor(private oauthService: OAuthService, private router: Router) { }
|
||||||
|
|
||||||
saveConfig(cfg: Partial<AuthConfig>) {
|
saveConfig(cfg: Partial<AuthConfig>) {
|
||||||
try {
|
try {
|
||||||
@@ -52,7 +53,7 @@ export class AuthenticationService {
|
|||||||
// Restore configuration from storage and apply to OAuthService
|
// Restore configuration from storage and apply to OAuthService
|
||||||
restoreConfiguration(): boolean {
|
restoreConfiguration(): boolean {
|
||||||
const cfg = this.loadConfig() ?? this.config;
|
const cfg = this.loadConfig() ?? this.config;
|
||||||
if (!cfg) return false;
|
if (!cfg.issuer) return false;
|
||||||
this.oauthService.configure(cfg);
|
this.oauthService.configure(cfg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -70,16 +71,18 @@ export class AuthenticationService {
|
|||||||
|
|
||||||
// Call this on the callback route to process the redirect and obtain tokens + profile
|
// Call this on the callback route to process the redirect and obtain tokens + profile
|
||||||
handleCallback(): Promise<any> {
|
handleCallback(): Promise<any> {
|
||||||
this.restoreConfiguration();
|
if (this.restoreConfiguration())
|
||||||
// Ensure discovery document loaded, then process code flow, then load profile
|
// Ensure discovery document loaded, then process code flow, then load profile
|
||||||
return this.oauthService
|
return this.oauthService
|
||||||
.loadDiscoveryDocumentAndTryLogin()
|
.loadDiscoveryDocumentAndTryLogin()
|
||||||
.then((isLoggedIn: boolean) => {
|
.then((isLoggedIn: boolean) => {
|
||||||
if (!isLoggedIn && !this.oauthService.hasValidAccessToken()) {
|
if (!isLoggedIn && !this.oauthService.hasValidAccessToken()) {
|
||||||
return Promise.reject('No valid token after callback');
|
return Promise.reject('No valid token after callback');
|
||||||
}
|
}
|
||||||
return this.loadUserProfile();
|
return this.loadUserProfile();
|
||||||
});
|
});
|
||||||
|
else
|
||||||
|
return this.router.navigate(['/authentication/login']);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadUserProfile(): Promise<any> {
|
loadUserProfile(): Promise<any> {
|
||||||
|
|||||||
Reference in New Issue
Block a user