Permalink
Browse files

fix(baseConfig): explain getExpirationDateFromResponse and ensure format

  • Loading branch information...
doktordirk committed Oct 7, 2016
1 parent ed1fed8 commit ee30ce4793cf3d29b4d7f85756f4a636827dd11f
Showing with 11 additions and 11 deletions.
  1. +3 −3 doc/baseConfig.md
  2. +3 −3 src/authentication.js
  3. +5 −5 src/baseConfig.js
@@ -125,13 +125,13 @@ storage = 'localStorage';
storageKey = 'aurelia_authentication';
// full page reload if authorization changed in another tab (recommended to set it to 'true')
storageChangedReload = false;
// optional function to extract the expiration date. takes the server response as parameter
// optional function to extract the expiration date. Takes the server response as parameter and returns number of seconds! since 1 January 1970 00:00:00 UTC (Unix Epoch)
// eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000;
getExpirationDateFromResponse = null;
// optional function to extract the access token from the response. takes the server response as parameter
// optional function to extract the access token from the response. Takes the server response as parameter and returns a token
// eg: getAccessTokenFromResponse = serverResponse => serverResponse.data[0].access_token;
getAccessTokenFromResponse = null;
// optional function to extract the refresh token from the response. takes the server response as parameter
// optional function to extract the refresh token from the response. Takes the server response as parameter and returns a token
// eg: getRefreshTokenFromResponse = serverResponse => serverResponse.data[0].refresh_token;
getRefreshTokenFromResponse = null;
@@ -186,9 +186,9 @@ export class Authentication {
} catch (_) {} // eslint-disable-line no-empty
// get exp either with from jwt or with supplied function
this.exp = typeof this.config.getExpirationDateFromResponse === 'function'
? this.config.getExpirationDateFromResponse(response)
: (this.payload && parseInt(this.payload.exp, 10)) || NaN;
this.exp = parseInt((typeof this.config.getExpirationDateFromResponse === 'function'
? this.config.getExpirationDateFromResponse(response)
: this.payload && this.payload.exp), 10) || NaN;
this.responseAnalyzed = true;
@@ -151,22 +151,22 @@ export class BaseConfig {
storage = 'localStorage';
// The key used for storing the authentication response locally
storageKey = 'aurelia_authentication';
// full page reload if authorization changed in another tab (recommended to set it to 'true')
// full page reload if authorization changed in another tab (recommended to set it to 'true')
storageChangedReload = false;
// optional function to extract the expiration date. takes the server response as parameter
// optional function to extract the expiration date. Takes the server response as parameter and returns number of seconds! since 1 January 1970 00:00:00 UTC (Unix Epoch)
// eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000;
getExpirationDateFromResponse = null;
// optional function to extract the access token from the response. takes the server response as parameter
// optional function to extract the access token from the response. Takes the server response as parameter and returns a token
// eg: getAccessTokenFromResponse = serverResponse => serverResponse.data[0].access_token;
getAccessTokenFromResponse = null;
// optional function to extract the refresh token from the response. takes the server response as parameter
// optional function to extract the refresh token from the response. Takes the server response as parameter and returns a token
// eg: getRefreshTokenFromResponse = serverResponse => serverResponse.data[0].refresh_token;
getRefreshTokenFromResponse = null;
// List of value-converters to make global
globalValueConverters = ['authFilterValueConverter'];
//OAuth provider specific related configuration
//OAuth provider specific related configuration
// ============================================
providers = {
facebook: {

0 comments on commit ee30ce4

Please sign in to comment.