Skip to content

Commit b1f3b78

Browse files
committed
Added typedoc and minor test update
1 parent e336660 commit b1f3b78

5 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/app/core/auth/auth.effects.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ describe('AuthEffects', () => {
221221

222222
expect(authEffects.checkTokenCookie$).toBeObservable(expected);
223223
authEffects.checkTokenCookie$.subscribe(() => {
224-
expect(authServiceStub.setExternalAuthStatus).toHaveBeenCalledWith(true);
224+
expect(authServiceStub.setExternalAuthStatus).toHaveBeenCalled();
225+
expect(authServiceStub.isExternalAuthentication).toBeTrue();
225226
expect((authEffects as any).authorizationsService.invalidateAuthorizationsRequestCache).toHaveBeenCalled();
226227
});
227228
});

src/app/core/auth/auth.service.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,19 @@ export class AuthService {
156156
return this.store.pipe(select(isAuthenticatedLoaded));
157157
}
158158

159+
/**
160+
* Used to set the external authentication status when authenticating via an
161+
* external authentication system (e.g. Shibboleth).
162+
* @param external
163+
*/
159164
public setExternalAuthStatus(external: boolean) {
160165
this.store.dispatch(new SetAuthCookieStatus(external));
161166
}
162167

168+
/**
169+
* Returns true if an external authentication system (e.g. Shibboleth) is being used
170+
* for authentication. Returns false otherwise.
171+
*/
163172
public isExternalAuthentication(): Observable<boolean> {
164173
return this.store.pipe(
165174
select(getExternalAuthCookieStatus));

src/app/core/auth/selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const isAuthenticated = createSelector(getAuthState, _isAuthenticated);
181181
export const isAuthenticatedLoaded = createSelector(getAuthState, _isAuthenticatedLoaded);
182182

183183
/**
184-
* Returns the authentication cookie status. Expect to be ture when external authentication
184+
* Returns the authentication cookie status. Expect to be true when external authentication
185185
* is used.
186186
* @function getExternalAuthCookieStatus
187187
* @param {AuthState} state

src/app/shared/testing/auth-service.stub.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class AuthServiceStub {
1717
token: AuthTokenInfo = new AuthTokenInfo('token_test');
1818
impersonating: string;
1919
private _tokenExpired = false;
20+
private _isExternalAuth = false;
2021
private redirectUrl;
2122

2223
constructor() {
@@ -123,11 +124,11 @@ export class AuthServiceStub {
123124
return;
124125
}
125126
setExternalAuthStatus(externalCookie: boolean) {
126-
return;
127+
this._isExternalAuth = externalCookie;
127128
}
128129

129130
isExternalAuthentication(): Observable<boolean> {
130-
return;
131+
return observableOf(this._isExternalAuth);
131132
}
132133

133134
retrieveAuthMethodsFromAuthStatus(status: AuthStatus) {

src/modules/app/browser-init.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class BrowserInitService extends InitService {
5656
protected authService: AuthService,
5757
protected themeService: ThemeService,
5858
protected menuService: MenuService,
59-
private rootDatatService: RootDataService
59+
private rootDataService: RootDataService
6060
) {
6161
super(
6262
store,
@@ -153,7 +153,7 @@ export class BrowserInitService extends InitService {
153153
filter((externalAuth: boolean) => externalAuth)
154154
).subscribe(() => {
155155
// Clear the transferState data.
156-
this.rootDatatService.invalidateRootCache();
156+
this.rootDataService.invalidateRootCache();
157157
this.authService.setExternalAuthStatus(false);
158158
}
159159
);

0 commit comments

Comments
 (0)