mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Added typedoc and minor test update
This commit is contained in:
@@ -221,7 +221,8 @@ describe('AuthEffects', () => {
|
||||
|
||||
expect(authEffects.checkTokenCookie$).toBeObservable(expected);
|
||||
authEffects.checkTokenCookie$.subscribe(() => {
|
||||
expect(authServiceStub.setExternalAuthStatus).toHaveBeenCalledWith(true);
|
||||
expect(authServiceStub.setExternalAuthStatus).toHaveBeenCalled();
|
||||
expect(authServiceStub.isExternalAuthentication).toBeTrue();
|
||||
expect((authEffects as any).authorizationsService.invalidateAuthorizationsRequestCache).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -156,10 +156,19 @@ export class AuthService {
|
||||
return this.store.pipe(select(isAuthenticatedLoaded));
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to set the external authentication status when authenticating via an
|
||||
* external authentication system (e.g. Shibboleth).
|
||||
* @param external
|
||||
*/
|
||||
public setExternalAuthStatus(external: boolean) {
|
||||
this.store.dispatch(new SetAuthCookieStatus(external));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if an external authentication system (e.g. Shibboleth) is being used
|
||||
* for authentication. Returns false otherwise.
|
||||
*/
|
||||
public isExternalAuthentication(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(getExternalAuthCookieStatus));
|
||||
|
@@ -181,7 +181,7 @@ export const isAuthenticated = createSelector(getAuthState, _isAuthenticated);
|
||||
export const isAuthenticatedLoaded = createSelector(getAuthState, _isAuthenticatedLoaded);
|
||||
|
||||
/**
|
||||
* Returns the authentication cookie status. Expect to be ture when external authentication
|
||||
* Returns the authentication cookie status. Expect to be true when external authentication
|
||||
* is used.
|
||||
* @function getExternalAuthCookieStatus
|
||||
* @param {AuthState} state
|
||||
|
@@ -17,6 +17,7 @@ export class AuthServiceStub {
|
||||
token: AuthTokenInfo = new AuthTokenInfo('token_test');
|
||||
impersonating: string;
|
||||
private _tokenExpired = false;
|
||||
private _isExternalAuth = false;
|
||||
private redirectUrl;
|
||||
|
||||
constructor() {
|
||||
@@ -123,11 +124,11 @@ export class AuthServiceStub {
|
||||
return;
|
||||
}
|
||||
setExternalAuthStatus(externalCookie: boolean) {
|
||||
return;
|
||||
this._isExternalAuth = externalCookie;
|
||||
}
|
||||
|
||||
isExternalAuthentication(): Observable<boolean> {
|
||||
return;
|
||||
return observableOf(this._isExternalAuth);
|
||||
}
|
||||
|
||||
retrieveAuthMethodsFromAuthStatus(status: AuthStatus) {
|
||||
|
@@ -56,7 +56,7 @@ export class BrowserInitService extends InitService {
|
||||
protected authService: AuthService,
|
||||
protected themeService: ThemeService,
|
||||
protected menuService: MenuService,
|
||||
private rootDatatService: RootDataService
|
||||
private rootDataService: RootDataService
|
||||
) {
|
||||
super(
|
||||
store,
|
||||
@@ -153,7 +153,7 @@ export class BrowserInitService extends InitService {
|
||||
filter((externalAuth: boolean) => externalAuth)
|
||||
).subscribe(() => {
|
||||
// Clear the transferState data.
|
||||
this.rootDatatService.invalidateRootCache();
|
||||
this.rootDataService.invalidateRootCache();
|
||||
this.authService.setExternalAuthStatus(false);
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user