@seges/angular-authentication-service
Advanced tools
+1
-1
| { | ||
| "name": "@seges/angular-authentication-service", | ||
| "version": "3.2.0", | ||
| "version": "3.3.0", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -25,3 +25,3 @@ import * as angular from "angular"; | ||
| (event: ng.IAngularEvent, toState: IAuthorizedState) => { | ||
| if (!toState.data || !toState.data.roles) { | ||
| if (!toState.data) { | ||
| return; | ||
@@ -31,3 +31,3 @@ } | ||
| }); | ||
| }; | ||
| } | ||
@@ -44,3 +44,3 @@ private token: string; | ||
| private authenticateUrl: string, | ||
| private logoutUrl: string | ||
| private logoutUrl: string, | ||
| ) { | ||
@@ -69,4 +69,3 @@ } | ||
| const returnUrl = toState ? this.$state.href(toState, {}, { absolute: true }) : this.$window.location.href; | ||
| this.redirectToAuthenticationToken(returnUrl); | ||
| this.redirectToAuthenticationToken(this.$window.location.href); | ||
| } | ||
@@ -111,3 +110,2 @@ | ||
| this.authenticate(); | ||
| this.$window.sessionStorage.removeItem("LoggedOut"); | ||
| } | ||
@@ -120,3 +118,2 @@ | ||
| this.logOutFromSingleSignOn(); | ||
| this.$window.sessionStorage.setItem("LoggedOut", "true"); | ||
| } | ||
@@ -189,4 +186,4 @@ | ||
| this.tokenExpiryDate = undefined; | ||
| delete this.$window.localStorage[this.storedTokenKey]; | ||
| delete this.$window.localStorage[this.storedTokenExpiryKey]; | ||
| this.$window.localStorage.removeItem(this.storedTokenKey); | ||
| this.$window.localStorage.removeItem(this.storedTokenExpiryKey); | ||
| delete this.$http.defaults.headers.common.Authorization; | ||
@@ -193,0 +190,0 @@ |
@@ -38,3 +38,5 @@ import "angular"; | ||
| }, | ||
| localStorage: {}, | ||
| localStorage: { | ||
| removeItem: (name: string) => { /* */ }, | ||
| }, | ||
| sessionStorage: { | ||
@@ -58,3 +60,3 @@ getItem: (name: string) => {/* */ }, | ||
| authenticateUrl, | ||
| logoutUrl | ||
| logoutUrl, | ||
| ); | ||
@@ -135,11 +137,2 @@ }); | ||
| it("should redirect to authenticate url with redirect url if state and not authenticated", () => { | ||
| const stateUrl = "dummyStateUrl"; | ||
| spyOn($state, "href").and.returnValue(stateUrl); | ||
| authenticateService.authenticate(event, {}); | ||
| expect($window.location.href).toMatch(stateUrl); | ||
| }); | ||
| it("should redirect to authenticate url if local storage expire date is before now", () => { | ||
@@ -146,0 +139,0 @@ $window.localStorage[tokenKey] = "someToken"; |
16600
-3.08%351
-1.96%