angular2-jwt
Advanced tools
Comparing version 0.1.26 to 0.1.27
@@ -11,2 +11,3 @@ import { Provider } from '@angular/core'; | ||
noJwtError: boolean; | ||
noClientCheck: boolean; | ||
noTokenScheme?: boolean; | ||
@@ -22,2 +23,3 @@ tokenGetter: () => string | Promise<string>; | ||
noJwtError?: boolean; | ||
noClientCheck?: boolean; | ||
globalHeaders?: Array<Object>; | ||
@@ -24,0 +26,0 @@ noTokenScheme?: boolean; |
@@ -16,15 +16,15 @@ "use strict"; | ||
}; | ||
var core_1 = require('@angular/core'); | ||
var http_1 = require('@angular/http'); | ||
var Observable_1 = require('rxjs/Observable'); | ||
require('rxjs/add/observable/fromPromise'); | ||
require('rxjs/add/operator/mergeMap'); | ||
var core_1 = require("@angular/core"); | ||
var http_1 = require("@angular/http"); | ||
var Observable_1 = require("rxjs/Observable"); | ||
require("rxjs/add/observable/fromPromise"); | ||
require("rxjs/add/operator/mergeMap"); | ||
var AuthConfigConsts = (function () { | ||
function AuthConfigConsts() { | ||
} | ||
AuthConfigConsts.DEFAULT_TOKEN_NAME = 'id_token'; | ||
AuthConfigConsts.DEFAULT_HEADER_NAME = 'Authorization'; | ||
AuthConfigConsts.HEADER_PREFIX_BEARER = 'Bearer '; | ||
return AuthConfigConsts; | ||
}()); | ||
AuthConfigConsts.DEFAULT_TOKEN_NAME = 'id_token'; | ||
AuthConfigConsts.DEFAULT_HEADER_NAME = 'Authorization'; | ||
AuthConfigConsts.HEADER_PREFIX_BEARER = 'Bearer '; | ||
exports.AuthConfigConsts = AuthConfigConsts; | ||
@@ -37,2 +37,3 @@ var AuthConfigDefaults = { | ||
noJwtError: false, | ||
noClientCheck: false, | ||
globalHeaders: [], | ||
@@ -57,2 +58,5 @@ noTokenScheme: false | ||
} | ||
if (config.tokenName && !config.tokenGetter) { | ||
this._config.tokenGetter = function () { return localStorage.getItem(config.tokenName); }; | ||
} | ||
} | ||
@@ -68,3 +72,3 @@ AuthConfig.prototype.getConfig = function () { | ||
function AuthHttpError() { | ||
_super.apply(this, arguments); | ||
return _super.apply(this, arguments) || this; | ||
} | ||
@@ -103,3 +107,3 @@ return AuthHttpError; | ||
AuthHttp.prototype.requestWithToken = function (req, token) { | ||
if (!tokenNotExpired(undefined, token)) { | ||
if (!this.config.noClientCheck && !tokenNotExpired(undefined, token)) { | ||
if (!this.config.noJwtError) { | ||
@@ -165,8 +169,8 @@ return new Observable_1.Observable(function (obs) { | ||
}; | ||
AuthHttp = __decorate([ | ||
core_1.Injectable(), | ||
__metadata('design:paramtypes', [AuthConfig, http_1.Http, http_1.RequestOptions]) | ||
], AuthHttp); | ||
return AuthHttp; | ||
}()); | ||
AuthHttp = __decorate([ | ||
core_1.Injectable(), | ||
__metadata("design:paramtypes", [AuthConfig, http_1.Http, http_1.RequestOptions]) | ||
], AuthHttp); | ||
exports.AuthHttp = AuthHttp; | ||
@@ -207,3 +211,5 @@ /** | ||
} | ||
for (var bc = 0, bs = void 0, buffer = void 0, idx = 0; | ||
for ( | ||
// initialize result and counters | ||
var bc = 0, bs = void 0, buffer = void 0, idx = 0; | ||
// get next character | ||
@@ -210,0 +216,0 @@ buffer = str.charAt(idx++); |
{ | ||
"name": "angular2-jwt", | ||
"version": "0.1.26", | ||
"version": "0.1.27", | ||
"description": "Helper library for handling JWTs in Angular 2", | ||
@@ -47,3 +47,3 @@ "repository": { | ||
"reflect-metadata": "0.1.8", | ||
"rxjs": "5.0.0-beta.12", | ||
"rxjs": "~5.0.0-beta.12", | ||
"typescript": "^2.0.2", | ||
@@ -50,0 +50,0 @@ "webpack": "^1.13.0", |
@@ -16,3 +16,3 @@ # angular2-jwt | ||
- [Configuring angular2-jwt with `provideAuth`](#configuring-angular2-jwt-with-provideauth) | ||
- [Configuation for Ionic 2](#configuation-for-ionic-2) | ||
- [Configuration for Ionic 2](#configuration-for-ionic-2) | ||
- [Sending Per-Request Headers](#sending-per-request-headers) | ||
@@ -157,3 +157,3 @@ - [Using the Observable Token Stream](#using-the-observable-token-stream) | ||
### Configuation for Ionic 2 | ||
### Configuration for Ionic 2 | ||
@@ -384,3 +384,3 @@ To configure angular2-jwt in Ionic 2 applications, use the factory pattern in your `@NgModule`. Since Ionic 2 provides its own API for accessing local storage, configure the `tokenGetter` to use it. | ||
[Auth0](auth0.com) | ||
[Auth0](https://auth0.com) | ||
@@ -387,0 +387,0 @@ ## License |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42208
11
411