How to use the njwt.createVerifier function in njwt

To help you get started, we’ve selected a few njwt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stormpath / express-stormpath / lib / okta / access-token-authenticator.js View on Github external
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
      }
    });
github stormpath / stormpath-sdk-node / lib / oauth / stormpath-access-token-authenticator.js View on Github external
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));
}