Added typedoc and minor test update

This commit is contained in:
Michael W Spalti
2023-04-19 11:36:42 -07:00
parent e336660cdd
commit b1f3b785e1
5 changed files with 17 additions and 6 deletions

View File

@@ -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();
});
});

View File

@@ -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));

View File

@@ -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

View File

@@ -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) {

View File

@@ -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);
}
);