Branch upadate

This commit is contained in:
Julius Gruber
2019-08-05 09:00:13 +02:00
parent f086ee79a5
commit d25f12590d
5 changed files with 30 additions and 6 deletions

View File

@@ -47,10 +47,10 @@ export function getCommunityModulePath() {
path: 'workspaceitems', path: 'workspaceitems',
loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule'
}, },
/* { {
path: 'workflowitems', path: 'workflowitems',
loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowitemsEditPageModule' loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule' // WorkflowItemsEditPageModule
},*/ },
{path: '**', pathMatch: 'full', component: PageNotFoundComponent}, {path: '**', pathMatch: 'full', component: PageNotFoundComponent},
]) ])
], ],

View File

@@ -22,6 +22,7 @@ import {RedirectWhenTokenExpiredAction, RefreshTokenAction} from './auth.actions
import {Store} from '@ngrx/store'; import {Store} from '@ngrx/store';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {AuthError} from './models/auth-error.model'; import {AuthError} from './models/auth-error.model';
import {AuthMethodModel} from './models/auth-method.model';
@Injectable() @Injectable()
export class AuthInterceptor implements HttpInterceptor { export class AuthInterceptor implements HttpInterceptor {
@@ -31,6 +32,8 @@ export class AuthInterceptor implements HttpInterceptor {
// we're creating a refresh token request list // we're creating a refresh token request list
protected refreshTokenRequestUrls = []; protected refreshTokenRequestUrls = [];
private
constructor(private inj: Injector, private router: Router, private store: Store<AppState>) { constructor(private inj: Injector, private router: Router, private store: Store<AppState>) {
} }
@@ -62,11 +65,22 @@ export class AuthInterceptor implements HttpInterceptor {
return http.url && http.url.endsWith('/authn/logout'); return http.url && http.url.endsWith('/authn/logout');
} }
private makeAuthStatusObject(authenticated: boolean, accessToken?: string, error?: string, location?: string): AuthStatus { private parseAuthMethodsfromHeaders(headers: HttpHeaders): AuthMethodModel[] {
console.log('parseAuthMethodsfromHeaders(): ', headers);
// errorHeaders
return [];
}
private makeAuthStatusObject(authenticated: boolean, accessToken?: string, error?: string, location?: string, httpHeaders?: HttpHeaders, ): AuthStatus {
const authStatus = new AuthStatus(); const authStatus = new AuthStatus();
const authMethods: AuthMethodModel[] = this.parseAuthMethodsfromHeaders(httpHeaders);
authStatus.id = null; authStatus.id = null;
authStatus.okay = true; authStatus.okay = true;
authStatus.ssoLoginUrl = location; // this line was added while developing shibboleth login authStatus.authMethods = authMethods;
authStatus.ssoLoginUrl = location; // this line was added while developing shibboleth login 1.0 - remove it
if (authenticated) { if (authenticated) {
authStatus.authenticated = true; authStatus.authenticated = true;
authStatus.token = new AuthTokenInfo(accessToken); authStatus.token = new AuthTokenInfo(accessToken);
@@ -179,7 +193,7 @@ export class AuthInterceptor implements HttpInterceptor {
} }
// Create a new HttpResponse and return it, so it can be handle properly by AuthService. // Create a new HttpResponse and return it, so it can be handle properly by AuthService.
const authResponse = new HttpResponse({ const authResponse = new HttpResponse({
body: this.makeAuthStatusObject(false, null, error.error, location), body: this.makeAuthStatusObject(false, null, error.error, location, error.headers ),
headers: error.headers, headers: error.headers,
status: error.status, status: error.status,
statusText: error.statusText, statusText: error.statusText,

View File

@@ -0,0 +1,4 @@
export class AuthMethodModel {
authMethodName: string;
location?: string;
}

View File

@@ -5,6 +5,7 @@ import { RemoteData } from '../../data/remote-data';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { CacheableObject } from '../../cache/object-cache.reducer'; import { CacheableObject } from '../../cache/object-cache.reducer';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
import {AuthMethodModel} from './auth-method.model';
/** /**
* Object that represents the authenticated status of a user * Object that represents the authenticated status of a user
@@ -53,4 +54,7 @@ export class AuthStatus implements CacheableObject {
self: string; self: string;
ssoLoginUrl: string; ssoLoginUrl: string;
authMethods: AuthMethodModel[];
} }

View File

@@ -4,6 +4,7 @@ import { mapsTo, relationship } from '../../cache/builders/build-decorators';
import { NormalizedObject } from '../../cache/models/normalized-object.model'; import { NormalizedObject } from '../../cache/models/normalized-object.model';
import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer';
import { EPerson } from '../../eperson/models/eperson.model'; import { EPerson } from '../../eperson/models/eperson.model';
import {AuthMethodModel} from './auth-method.model';
@mapsTo(AuthStatus) @mapsTo(AuthStatus)
@inheritSerialization(NormalizedObject) @inheritSerialization(NormalizedObject)
@@ -38,4 +39,5 @@ export class NormalizedAuthStatus extends NormalizedObject<AuthStatus> {
@relationship(EPerson, false) @relationship(EPerson, false)
@autoserialize @autoserialize
eperson: string; eperson: string;
} }