Browse Source
Merge pull request #7148 from olicooper/pr/angular-auth-guard
angular: Fix AuthGuard returning 'true' when user not authorized
pull/7162/head
Mehmet Erim
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
2 additions and
2 deletions
-
npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts
-
npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts
|
|
|
@ -17,6 +17,6 @@ export class AuthGuard implements CanActivate { |
|
|
|
} |
|
|
|
|
|
|
|
this.authService.initLogin(); |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -26,7 +26,7 @@ describe('AuthGuard', () => { |
|
|
|
spectator.inject(OAuthService).hasValidAccessToken.andReturn(false); |
|
|
|
const initLoginSpy = jest.spyOn(authService, 'initLogin'); |
|
|
|
|
|
|
|
expect(guard.canActivate()).toBe(true); |
|
|
|
expect(guard.canActivate()).toBe(false); |
|
|
|
expect(initLoginSpy).toHaveBeenCalled(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|