2017-12-26 19 views
1

ここでは、私の快適ゾーンからNodeJS - wayを使用してIDサーバー4認証を行う方法を理解しようとしています。IdentityServer 4 for NodeJS API

services.AddAuthentication(IdentityServerAuthenticationDefaults 
.AuthenticationScheme) 
    .AddIdentityServerAuthentication(
     options => 
     { 
      options.Authority = "<authority-url>"; 
      options.ApiName = "<api-url>"; 
      }); 

C#実装が秘密または同様に提供されていないように私はここに流れの中で何かが欠けている - ので、トークンは、おそらくアイデンティティサーバーを経由して検証されますか?それを検証するための「秘密」がない場合、NodeJSを使用してトークンを確認するにはどうすればよいでしょうか?

私はつまずいたintrospection endpoint - 私は正しい方向に向かっていますか?

答えて

0

私はjwksを使用してこの問題を解決することができたが-endpoint、それはトークンを検証するために、公開鍵だし、私も、私はミドルウェアを調製するために使用される素敵なpackageが見つかりました:

private issuer: string = process.env.idsrv; 


auth = jwt({ 
    secret: jwksClient.expressJwtSecret({ 
     cache: true,  // see https://github.com/auth0/node-jwks-rsa#caching, 
     cacheMaxAge: ms('24h'), 
     rateLimit: true, // see https://github.com/auth0/node-jwks-rsa#rate-limiting 
     jwksRequestsPerMinute: 100, 
     jwksUri: `${this.issuer}/.well-known/jwks` 
    }), 

    // validate the audience & issuer from received token vs JWKS endpoint 
    audience: `${this.issuer}/resources`, 
    issuer: this.issuer, 
    algorithms: ["RS256"] 
});