Commit 1304aead authored by François Agneray's avatar François Agneray
Browse files

Add href option

parent b5677a18
Pipeline #3730 passed with stages
in 7 minutes and 9 seconds
......@@ -18,15 +18,27 @@ export class AuthEffects {
@Effect({ dispatch: false })
loginAction$ = this.actions$.pipe(
ofType(authActions.LOGIN),
tap(_ => this.keycloak.login({
redirectUri: window.location.origin + environment.ssoLoginRedirectUri
}))
tap(_ => {
let redirectUri = window.location.origin;
if (environment.baseHref !== '/') {
redirectUri += environment.baseHref;
}
redirectUri += environment.ssoLoginRedirectUri;
this.keycloak.login({ redirectUri });
})
);
@Effect({ dispatch: false })
logoutAction$ = this.actions$.pipe(
ofType(authActions.LOGOUT),
tap(_ => this.keycloak.logout(window.location.origin + environment.ssoLogoutRedirectUri))
tap(_ => {
let redirectUri = window.location.origin;
if (environment.baseHref !== '/') {
redirectUri += environment.baseHref;
}
redirectUri += environment.ssoLogoutRedirectUri;
this.keycloak.logout(redirectUri);
})
);
@Effect()
......
<nav class="navbar navbar-light bg-light navbar-expand-md fixed-top border-bottom">
<!-- Logo -->
<a href="/" class="navbar-brand">
<a href="{{ baseHref }}" class="navbar-brand">
<img src="assets/anis_adminsi.png" alt="CeSAM logo" />
</a>
......
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { UserProfile } from '../../auth/user-profile.model';
import { environment } from '../../../environments/environment'
@Component({
selector: 'app-nav',
......@@ -7,10 +9,11 @@ import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NavComponent {
@Input() userProfile: any;
@Input() userProfile: UserProfile;
@Output() logout: EventEmitter<any> = new EventEmitter();
@Output() openEditProfile: EventEmitter<any> = new EventEmitter();
isCollapsed = true;
baseHref: string = environment.baseHref;
emitLogout() {
this.logout.emit();
......
export const environment = {
production: true,
apiUrl: '/server',
baseHref: '/admin',
ssoAuthUrl: 'https://anis-dev.lam.fr/auth',
ssoRealm: 'anis',
ssoClientId: 'anis-admin',
ssoLoginRedirectUri: '/',
ssoLogoutRedirectUri: '/login'
ssoLoginRedirectUri: '/admin',
ssoLogoutRedirectUri: '/admin/login'
};
......@@ -5,6 +5,7 @@
export const environment = {
production: false,
apiUrl: 'http://localhost:8080',
baseHref: '/',
ssoAuthUrl: 'http://localhost:8180/auth',
ssoRealm: 'anis',
ssoClientId: 'anis-admin',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment