Skip to content

Commit

Permalink
Added automatic token renewal feature and relased new plugin version.
Browse files Browse the repository at this point in the history
  • Loading branch information
matik12 committed Feb 19, 2017
1 parent c69e0a0 commit 9078dee
Show file tree
Hide file tree
Showing 23 changed files with 389 additions and 142 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export interface OAuthConfig {
state?: string;
redirectUri?: string;
alwaysRequireLogin?: boolean;
autoTokenRenewal?: boolean;
}

export interface OAuthTokenConfig {
Expand All @@ -236,7 +237,7 @@ export interface OAuthTokenConfig {
}
```

## Added support for both aurelia-fetch-client and aurelia-http-client
## Added support for both aurelia-fetch-client and aurelia-http-client (v.0.2.0)

Currently, aurelia-oauth provides basic feature of adding authorization header to every request by using custom interceptor, which should work well with both client plugins. However, there is one slight difference in behaviour and in case of **aurelia-http-client** which has support for cancelling requests, plugin can abort request when checks that token has expired before the request was made. In both plugins the request response, which is passed in the promise chain contains additional flag **tokenExpired** in case that, was the reason request has failed.

Expand All @@ -260,3 +261,7 @@ this.http.get('https://api.com')
alert(reason.requestMessage.tokenExpired);
});
```

## Added feature: automatic token renewal (v.0.3.0)

Automatic token renewal feature can help preventing application token from expiration. First, it tracks token expiration time and then 30 seconds before the token is going to expire, it will create invisible IFrame that can obtain new token from Identity Server login page. In some cases, obtaining new token will not be possible, therefore standard behaviour will occur i.e. invalidToken event broadcasting via EventAggregator. This feature is enabled by default, but could be disabled simply setting flag **autoTokenRenewal** to false when configuring OAuthService and invoking oauthService.configure() method.
63 changes: 47 additions & 16 deletions dist/amd/oauth-service.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/amd/oauth-token-service.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/amd/url-hash-service.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 47 additions & 16 deletions dist/commonjs/oauth-service.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions dist/commonjs/oauth-token-service.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/commonjs/url-hash-service.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/dts/oauth-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface OAuthConfig {
state?: string;
redirectUri?: string;
alwaysRequireLogin?: boolean;
autoTokenRenewal?: boolean;
}
export declare class OAuthService {
private oAuthTokenService;
Expand All @@ -32,4 +33,6 @@ export declare class OAuthService {
private getTokenDataFromUrl;
private getBaseRouteUrl;
private getSimpleNonceValue;
private getRedirectUrl();
private setAutomaticTokenRenewal();
}
1 change: 1 addition & 0 deletions dist/dts/oauth-token-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export declare class OAuthTokenService {
getIdToken: () => string;
getAuthorizationHeader: () => string;
getTokenType: () => string;
getTokenExpirationTime: () => number;
removeToken: () => OAuthTokenData;
isTokenValid: () => boolean;
private getTimeNow;
Expand Down
4 changes: 2 additions & 2 deletions dist/dts/url-hash-service.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class UrlHashService {
getHash: () => string;
getHashData: () => any;
getHash: (hashValue?: string) => string;
getHashData: (hashValue?: string) => any;
clearHash: () => void;
private decodeUrlData;
}
Loading

0 comments on commit 9078dee

Please # to comment.