Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-oauth2-oidc

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-oauth2-oidc - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

2

angular-oauth2-oidc.metadata.json

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":3,"metadata":{"OAuthModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[],"exports":[]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"OAuthModule"},"providers":[{"__symbolic":"reference","name":"OAuthService"},{"__symbolic":"reference","name":"ɵa"}]}}}},"OAuthService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/http","name":"Http"},{"__symbolic":"reference","name":"ɵa"}]}],"getKeyCount":[{"__symbolic":"method"}],"debug":[{"__symbolic":"method"}],"validateUrlFromDiscoveryDocument":[{"__symbolic":"method"}],"validateUrlForHttps":[{"__symbolic":"method"}],"validateUrlAgainstIssuer":[{"__symbolic":"method"}],"setupTimer":[{"__symbolic":"method"}],"setupAccessTokenTimer":[{"__symbolic":"method"}],"setupIdTokenTimer":[{"__symbolic":"method"}],"clearAccessTokenTimer":[{"__symbolic":"method"}],"clearIdTokenTimer":[{"__symbolic":"method"}],"calcTimeout":[{"__symbolic":"method"}],"setStorage":[{"__symbolic":"method"}],"loadDiscoveryDocument":[{"__symbolic":"method"}],"validateDiscoveryDocument":[{"__symbolic":"method"}],"fetchTokenUsingPasswordFlowAndLoadUserProfile":[{"__symbolic":"method"}],"loadUserProfile":[{"__symbolic":"method"}],"fetchTokenUsingPasswordFlow":[{"__symbolic":"method"}],"refreshToken":[{"__symbolic":"method"}],"removeSilentRefreshEventListener":[{"__symbolic":"method"}],"setupSilentRefreshEventListener":[{"__symbolic":"method"}],"silentRefresh":[{"__symbolic":"method"}],"createLoginUrl":[{"__symbolic":"method"}],"initImplicitFlow":[{"__symbolic":"method"}],"callOnTokenReceivedIfExists":[{"__symbolic":"method"}],"storeAccessTokenResponse":[{"__symbolic":"method"}],"tryLogin":[{"__symbolic":"method"}],"validateNonceForAccessToken":[{"__symbolic":"method"}],"storeIdToken":[{"__symbolic":"method"}],"handleLoginError":[{"__symbolic":"method"}],"processIdToken":[{"__symbolic":"method"}],"getIdentityClaims":[{"__symbolic":"method"}],"getIdToken":[{"__symbolic":"method"}],"padBase64":[{"__symbolic":"method"}],"getAccessToken":[{"__symbolic":"method"}],"getAccessTokenExpiration":[{"__symbolic":"method"}],"getIdTokenExpiration":[{"__symbolic":"method"}],"hasValidAccessToken":[{"__symbolic":"method"}],"hasValidIdToken":[{"__symbolic":"method"}],"authorizationHeader":[{"__symbolic":"method"}],"logOut":[{"__symbolic":"method"}],"createAndSaveNonce":[{"__symbolic":"method"}],"createNonce":[{"__symbolic":"method"}],"checkAtHash":[{"__symbolic":"method"}],"checkSignature":[{"__symbolic":"method"}]}},"JwksValidationHandler":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AbstractValidationHandler"},"members":{"validateSignature":[{"__symbolic":"method"}],"alg2kty":[{"__symbolic":"method"}],"calcHash":[{"__symbolic":"method"}],"toByteArrayAsString":[{"__symbolic":"method"}]}},"NullValidationHandler":{"__symbolic":"class","members":{"validateSignature":[{"__symbolic":"method"}],"validateAtHash":[{"__symbolic":"method"}]}},"ValidationParams":{"__symbolic":"interface"},"ValidationHandler":{"__symbolic":"interface"},"AbstractValidationHandler":{"__symbolic":"class","members":{"validateSignature":[{"__symbolic":"method"}],"validateAtHash":[{"__symbolic":"method"}],"inferHashAlgorithm":[{"__symbolic":"method"}],"calcHash":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"getHashFragmentParams":[{"__symbolic":"method"}],"parseQueryString":[{"__symbolic":"method"}]}}},"origins":{"OAuthModule":"./index","OAuthService":"./oauth-service","JwksValidationHandler":"./token-validation/jwks-validation-handler","NullValidationHandler":"./token-validation/null-validation-handler","ValidationParams":"./token-validation/validation-handler","ValidationHandler":"./token-validation/validation-handler","AbstractValidationHandler":"./token-validation/validation-handler","ɵa":"./url-helper.service"},"importAs":"angular-oauth2-oidc"}
{"__symbolic":"module","version":3,"metadata":{"OAuthModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[],"exports":[]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"OAuthModule"},"providers":[{"__symbolic":"reference","name":"OAuthService"},{"__symbolic":"reference","name":"ɵa"}]}}}},"OAuthService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/http","name":"Http"},{"__symbolic":"reference","name":"ɵa"}]}],"getKeyCount":[{"__symbolic":"method"}],"debug":[{"__symbolic":"method"}],"validateUrlFromDiscoveryDocument":[{"__symbolic":"method"}],"validateUrlForHttps":[{"__symbolic":"method"}],"validateUrlAgainstIssuer":[{"__symbolic":"method"}],"setupTimer":[{"__symbolic":"method"}],"setupAccessTokenTimer":[{"__symbolic":"method"}],"setupIdTokenTimer":[{"__symbolic":"method"}],"clearAccessTokenTimer":[{"__symbolic":"method"}],"clearIdTokenTimer":[{"__symbolic":"method"}],"calcTimeout":[{"__symbolic":"method"}],"setStorage":[{"__symbolic":"method"}],"loadDiscoveryDocument":[{"__symbolic":"method"}],"loadJwks":[{"__symbolic":"method"}],"validateDiscoveryDocument":[{"__symbolic":"method"}],"fetchTokenUsingPasswordFlowAndLoadUserProfile":[{"__symbolic":"method"}],"loadUserProfile":[{"__symbolic":"method"}],"fetchTokenUsingPasswordFlow":[{"__symbolic":"method"}],"refreshToken":[{"__symbolic":"method"}],"removeSilentRefreshEventListener":[{"__symbolic":"method"}],"setupSilentRefreshEventListener":[{"__symbolic":"method"}],"silentRefresh":[{"__symbolic":"method"}],"createLoginUrl":[{"__symbolic":"method"}],"initImplicitFlow":[{"__symbolic":"method"}],"callOnTokenReceivedIfExists":[{"__symbolic":"method"}],"storeAccessTokenResponse":[{"__symbolic":"method"}],"tryLogin":[{"__symbolic":"method"}],"validateNonceForAccessToken":[{"__symbolic":"method"}],"storeIdToken":[{"__symbolic":"method"}],"handleLoginError":[{"__symbolic":"method"}],"processIdToken":[{"__symbolic":"method"}],"getIdentityClaims":[{"__symbolic":"method"}],"getIdToken":[{"__symbolic":"method"}],"padBase64":[{"__symbolic":"method"}],"getAccessToken":[{"__symbolic":"method"}],"getAccessTokenExpiration":[{"__symbolic":"method"}],"getIdTokenExpiration":[{"__symbolic":"method"}],"hasValidAccessToken":[{"__symbolic":"method"}],"hasValidIdToken":[{"__symbolic":"method"}],"authorizationHeader":[{"__symbolic":"method"}],"logOut":[{"__symbolic":"method"}],"createAndSaveNonce":[{"__symbolic":"method"}],"createNonce":[{"__symbolic":"method"}],"checkAtHash":[{"__symbolic":"method"}],"checkSignature":[{"__symbolic":"method"}]}},"JwksValidationHandler":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AbstractValidationHandler"},"members":{"validateSignature":[{"__symbolic":"method"}],"alg2kty":[{"__symbolic":"method"}],"calcHash":[{"__symbolic":"method"}],"toByteArrayAsString":[{"__symbolic":"method"}]}},"NullValidationHandler":{"__symbolic":"class","members":{"validateSignature":[{"__symbolic":"method"}],"validateAtHash":[{"__symbolic":"method"}]}},"ValidationParams":{"__symbolic":"interface"},"ValidationHandler":{"__symbolic":"interface"},"AbstractValidationHandler":{"__symbolic":"class","members":{"validateSignature":[{"__symbolic":"method"}],"validateAtHash":[{"__symbolic":"method"}],"inferHashAlgorithm":[{"__symbolic":"method"}],"calcHash":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"getHashFragmentParams":[{"__symbolic":"method"}],"parseQueryString":[{"__symbolic":"method"}]}}},"origins":{"OAuthModule":"./index","OAuthService":"./oauth-service","JwksValidationHandler":"./token-validation/jwks-validation-handler","NullValidationHandler":"./token-validation/null-validation-handler","ValidationParams":"./token-validation/validation-handler","ValidationHandler":"./token-validation/validation-handler","AbstractValidationHandler":"./token-validation/validation-handler","ɵa":"./url-helper.service"},"importAs":"angular-oauth2-oidc"}

@@ -287,2 +287,4 @@ (function (global, factory) {

OAuthService.prototype.validateUrlForHttps = function (url) {
if (!url)
return true;
var /** @type {?} */ lcUrl = url.toLowerCase();

@@ -376,4 +378,4 @@ if (this.requireHttps == false)

var /** @type {?} */ delta = (expiration - now) * this.timeoutFactor;
var /** @type {?} */ timeout = now + delta;
return timeout;
// let timeout = now + delta;
return delta;
};

@@ -426,19 +428,15 @@ /**

_this.userinfoEndpoint = doc.userinfo_endpoint;
_this.jwksUri = doc.jwks_uri;
_this.discoveryDocumentLoaded = true;
_this.discoveryDocumentLoadedSubject.next(doc);
if (doc.jwks_uri) {
_this.http.get(doc.jwks_uri).map(function (r) { return r.json(); }).subscribe(function (jwks) {
_this.jwks = jwks;
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(doc);
}, function (err) {
console.error('error loading jwks', err);
_this.eventsSubject.next(new OAuthErrorEvent('jwks_load_error', err));
reject(err);
});
}
else {
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(doc);
}
_this.loadJwks().then(function (_) {
var /** @type {?} */ result = new OAuthSuccessEvent('discovery_document_loaded');
_this.eventsSubject.next(result);
resolve(result);
return;
}).catch(function (err) {
_this.eventsSubject.next(new OAuthErrorEvent('discovery_document_load_error', err));
reject(err);
return;
});
}, function (err) {

@@ -452,2 +450,24 @@ console.error('error loading dicovery document', err);

/**
* @return {?}
*/
OAuthService.prototype.loadJwks = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.jwksUri) {
_this.http.get(_this.jwksUri).map(function (r) { return r.json(); }).subscribe(function (jwks) {
_this.jwks = jwks;
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(jwks);
}, function (err) {
console.error('error loading jwks', err);
_this.eventsSubject.next(new OAuthErrorEvent('jwks_load_error', err));
reject(err);
});
}
else {
resolve(null);
}
});
};
/**
* @param {?} doc

@@ -763,5 +783,6 @@ * @return {?}

+ "&scope="
+ encodeURIComponent(scope)
+ "&login_hint="
+ encodeURIComponent(loginHint);
+ encodeURIComponent(scope);
if (loginHint) {
url += "&login_hint=" + encodeURIComponent(loginHint);
}
if (that.resource) {

@@ -968,2 +989,3 @@ url += "&resource=" + encodeURIComponent(that.resource);

/**
* \@ignore
* @param {?} idToken

@@ -1048,3 +1070,4 @@ * @param {?} accessToken

idTokenClaims: claims,
idTokenHeader: header
idTokenHeader: header,
loadKeys: function () { return _this.loadJwks(); }
};

@@ -1200,2 +1223,3 @@ if (this.requestAccessToken && !this.checkAtHash(validationParams)) {

/**
* \@ignore
* @return {?}

@@ -1364,5 +1388,8 @@ */

* @param {?} params
* @param {?=} retry
* @return {?}
*/
JwksValidationHandler.prototype.validateSignature = function (params) {
JwksValidationHandler.prototype.validateSignature = function (params, retry) {
var _this = this;
if (retry === void 0) { retry = false; }
if (!params.idToken)

@@ -1377,2 +1404,3 @@ throw new Error('Parameter idToken expected!');

}
console.debug('validateSignature: retry', retry);
var /** @type {?} */ kid = params.idTokenHeader['kid'];

@@ -1388,8 +1416,9 @@ var /** @type {?} */ keys = params.jwks['keys'];

var /** @type {?} */ matchingKeys = keys.filter(function (k) { return k['kty'] == kty_1 && k['use'] == 'sig'; });
/*
if (matchingKeys.length == 0) {
var /** @type {?} */ error = 'No matching key found.';
let error = 'No matching key found.';
console.error(error);
return Promise.reject(error);
}
else if (matchingKeys.length > 1) {
}*/
if (matchingKeys.length > 1) {
var /** @type {?} */ error = 'More than one matching key found. Please specify a kid in the id_token header.';

@@ -1399,5 +1428,18 @@ console.error(error);

}
key = matchingKeys[0];
else if (matchingKeys.length == 1) {
key = matchingKeys[0];
}
}
if (!key) {
if (!key && !retry && params.loadKeys) {
return params
.loadKeys()
.then(function (keys) { return params.jwks = keys; })
.then(function (_) { return _this.validateSignature(params, true); });
}
if (!key && retry && !kid) {
var /** @type {?} */ error = 'No matching key found.';
console.error(error);
return Promise.reject(error);
}
if (!key && retry && kid) {
var /** @type {?} */ error = 'expected key not found in property jwks. '

@@ -1404,0 +1446,0 @@ + 'This property is most likely loaded with the '

@@ -296,2 +296,4 @@ import { Injectable, NgModule } from '@angular/core';

OAuthService.prototype.validateUrlForHttps = function (url) {
if (!url)
return true;
var /** @type {?} */ lcUrl = url.toLowerCase();

@@ -385,4 +387,4 @@ if (this.requireHttps == false)

var /** @type {?} */ delta = (expiration - now) * this.timeoutFactor;
var /** @type {?} */ timeout = now + delta;
return timeout;
// let timeout = now + delta;
return delta;
};

@@ -435,19 +437,15 @@ /**

_this.userinfoEndpoint = doc.userinfo_endpoint;
_this.jwksUri = doc.jwks_uri;
_this.discoveryDocumentLoaded = true;
_this.discoveryDocumentLoadedSubject.next(doc);
if (doc.jwks_uri) {
_this.http.get(doc.jwks_uri).map(function (r) { return r.json(); }).subscribe(function (jwks) {
_this.jwks = jwks;
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(doc);
}, function (err) {
console.error('error loading jwks', err);
_this.eventsSubject.next(new OAuthErrorEvent('jwks_load_error', err));
reject(err);
});
}
else {
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(doc);
}
_this.loadJwks().then(function (_) {
var /** @type {?} */ result = new OAuthSuccessEvent('discovery_document_loaded');
_this.eventsSubject.next(result);
resolve(result);
return;
}).catch(function (err) {
_this.eventsSubject.next(new OAuthErrorEvent('discovery_document_load_error', err));
reject(err);
return;
});
}, function (err) {

@@ -461,2 +459,24 @@ console.error('error loading dicovery document', err);

/**
* @return {?}
*/
OAuthService.prototype.loadJwks = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.jwksUri) {
_this.http.get(_this.jwksUri).map(function (r) { return r.json(); }).subscribe(function (jwks) {
_this.jwks = jwks;
_this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));
resolve(jwks);
}, function (err) {
console.error('error loading jwks', err);
_this.eventsSubject.next(new OAuthErrorEvent('jwks_load_error', err));
reject(err);
});
}
else {
resolve(null);
}
});
};
/**
* @param {?} doc

@@ -772,5 +792,6 @@ * @return {?}

+ "&scope="
+ encodeURIComponent(scope)
+ "&login_hint="
+ encodeURIComponent(loginHint);
+ encodeURIComponent(scope);
if (loginHint) {
url += "&login_hint=" + encodeURIComponent(loginHint);
}
if (that.resource) {

@@ -977,2 +998,3 @@ url += "&resource=" + encodeURIComponent(that.resource);

/**
* \@ignore
* @param {?} idToken

@@ -1057,3 +1079,4 @@ * @param {?} accessToken

idTokenClaims: claims,
idTokenHeader: header
idTokenHeader: header,
loadKeys: function () { return _this.loadJwks(); }
};

@@ -1209,2 +1232,3 @@ if (this.requestAccessToken && !this.checkAtHash(validationParams)) {

/**
* \@ignore
* @return {?}

@@ -1373,5 +1397,8 @@ */

* @param {?} params
* @param {?=} retry
* @return {?}
*/
JwksValidationHandler.prototype.validateSignature = function (params) {
JwksValidationHandler.prototype.validateSignature = function (params, retry) {
var _this = this;
if (retry === void 0) { retry = false; }
if (!params.idToken)

@@ -1386,2 +1413,3 @@ throw new Error('Parameter idToken expected!');

}
console.debug('validateSignature: retry', retry);
var /** @type {?} */ kid = params.idTokenHeader['kid'];

@@ -1397,8 +1425,9 @@ var /** @type {?} */ keys = params.jwks['keys'];

var /** @type {?} */ matchingKeys = keys.filter(function (k) { return k['kty'] == kty_1 && k['use'] == 'sig'; });
/*
if (matchingKeys.length == 0) {
var /** @type {?} */ error = 'No matching key found.';
let error = 'No matching key found.';
console.error(error);
return Promise.reject(error);
}
else if (matchingKeys.length > 1) {
}*/
if (matchingKeys.length > 1) {
var /** @type {?} */ error = 'More than one matching key found. Please specify a kid in the id_token header.';

@@ -1408,5 +1437,18 @@ console.error(error);

}
key = matchingKeys[0];
else if (matchingKeys.length == 1) {
key = matchingKeys[0];
}
}
if (!key) {
if (!key && !retry && params.loadKeys) {
return params
.loadKeys()
.then(function (keys) { return params.jwks = keys; })
.then(function (_) { return _this.validateSignature(params, true); });
}
if (!key && retry && !kid) {
var /** @type {?} */ error = 'No matching key found.';
console.error(error);
return Promise.reject(error);
}
if (!key && retry && kid) {
var /** @type {?} */ error = 'expected key not found in property jwks. '

@@ -1413,0 +1455,0 @@ + 'This property is most likely loaded with the '

@@ -146,2 +146,3 @@ import { Http, Headers } from '@angular/http';

private idTokenTimeoutSubscription;
private jwksUri;
constructor(http: Http, urlHelper: UrlHelperService);

@@ -177,2 +178,3 @@ private getKeyCount();

loadDiscoveryDocument(fullUrl?: string): Promise<object>;
private loadJwks();
private validateDiscoveryDocument(doc);

@@ -249,4 +251,7 @@ /**

private handleLoginError(options, parts);
protected processIdToken(idToken: string, accessToken: string): Promise<ParsedIdToken>;
/**
* @ignore
*/
processIdToken(idToken: string, accessToken: string): Promise<ParsedIdToken>;
/**
* Returns the received claims about the user.

@@ -294,3 +299,6 @@ */

logOut(noRedirectToLogoutUrl?: boolean): void;
private createAndSaveNonce();
/**
* @ignore
*/
createAndSaveNonce(): Promise<string>;
protected createNonce(): Promise<string>;

@@ -297,0 +305,0 @@ private checkAtHash(params);

{
"name": "angular-oauth2-oidc",
"version": "2.0.5",
"version": "2.0.6",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -18,3 +18,3 @@ import { AbstractValidationHandler, ValidationParams } from "./validation-handler";

gracePeriodInSec: number;
validateSignature(params: ValidationParams): Promise<any>;
validateSignature(params: ValidationParams, retry?: boolean): Promise<any>;
private alg2kty(alg);

@@ -21,0 +21,0 @@ calcHash(valueToHash: string, algorithm: string): string;

@@ -7,2 +7,3 @@ export interface ValidationParams {

jwks: object;
loadKeys: () => Promise<object>;
}

@@ -9,0 +10,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc