観客にオフセット:.NETのコアクライアントはIdentityServer v3ので認証しない - 考える
IdentityServer v3の JavaScriptクライアント AspのコアAPIクライアント
はJavaScriptクライアントはidentityserverで認証し、AになりAPIへのベアラトークンによるリクエスト
apiはリソース所有者のワークフローを使用するように構成されています
問題: は今、私が手:
オーディエンス: 'http://localhost/identity/resources' を。一致していませんでした: validationParameters.ValidAudience: 'MyApi' または validationParameters.ValidAudiences: 'NULL'
Obiviously Audianceが一致していませんが。 私は何が欠けていますか?
コンフィグ
アイデンティティサーバーでApiClient:アイデンティティサーバーに接続するためのAPIで
return new Client
{
Enabled = true,
ClientId = "MyApi",
ClientName = "The client for the Groupl Api",
ClientSecrets = new List<Secret>
{
new Secret("foo".Sha256())
},
Flow = Flows.ResourceOwner,
AllowedScopes = ClientConstants.AllowedGrouplScopes()
};
:ここ
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var authority = config["identity:authority:url"];
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = authority,
RequireHttpsMetadata = false,
EnableCaching = false,
ApiName = "myApi", //Correct that this is the client id?
ApiSecret = "foo"
});
要求(access_tokenは省略)
GET /api/values HTTP/1.1
Host: localhost:59364
Content-Type: application/json
Authorization: Bearer {access_token}
更新
私はLegacyAudienceValidation = true
を設定すると、すべてが正常に動作しますが、私はこれを正しく処理するかどうかはわかりませんか?