Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
AccessTokenAuthenticator.prototype.authenticate = function authenticate(jwtAccessTokenString, callback) {
var self = this;
var verifier = nJwt.createVerifier()
.withKeyResolver(this.jwkResolver.bind(this))
.setSigningAlgorithm('RS256');
verifier.verify(jwtAccessTokenString, function (err, jwt) {
if (err) {
return callback(err);
}
var authenticationResult = new StormpathAccessTokenAuthenticationResult(self.client, {
jwt: jwtAccessTokenString,
expandedJwt: jwt,
account: {
href: self.client.config.org + 'api/v1/users/' + jwt.body.uid
}
});
function StormpathAccessTokenAuthenticator(client) {
if (!(this instanceof StormpathAccessTokenAuthenticator)) {
return new StormpathAccessTokenAuthenticator(client);
}
if (!(client instanceof Client)) {
throw new Error('StormpathAccessTokenAuthenticator must be given a Stormpath client instance');
}
this.client = client;
this.verifier = nJwt.createVerifier().withKeyResolver(tenantAdminKeyResolver.bind(null, client));
}