IISで実行されているIdentityServer3のインスタンスをセットアップしました。IdentityServer3 PostMan invalid_client
var validators = new List<Registration<ISecretValidator>>
{
new Registration<ISecretValidator, HashedSharedSecretValidator>(),
new Registration<ISecretValidator, X509CertificateThumbprintSecretValidator>()
};
// .Register() is an extension method that setups that setups the
// IdentityServerServiceFactory
var factory = new EntityFrameworkServiceOptions()
.Register()
.UseInMemoryUsers(Users.Get());
factory.SecretValidators = validators;
app.Map($"/{IdentityServer.Path}", server =>
{
server.UseIdentityServer(new IdentityServerOptions()
{
RequireSsl = false,
SiteName = siteName,
SigningCertificate = Certificate.Load(),
Factory = factory,
// Currently does nothing. There are no plugins.
PluginConfiguration = ConfigurePlugins,
AuthenticationOptions = new AuthenticationOptions()
{
EnablePostSignOutAutoRedirect = true,
// Currently does nothing. There are no IdentityProviders setup
IdentityProviders = ConfigureIdentityProviders
}
});
});
クライアント証明書フローのEFデータベースにクライアントをセットアップしました。したがって、Client
テーブルにクライアントがあり、ClientScopes
テーブルのスコープへのクライアントアクセスを許可しました。そして、クライアントにClientSecrets
テーブルの秘密を与えました。
データベースに格納されている適切な値は、(記載されていないすべての値がIdentityServer3のデフォルトです)、次のとおりです。
ClientId = 'client'
Flow = 'ClientCredentials [3]'
ClientScope = 'api'
ClientSecret = 'secret'.Sha256()
IdentityServerがテストサーバー上で実行されているため、「ローカルにアクセストークンを要求する」が選択されていません。
私は「リクエストトークン」をクリックすると、私は次のエラーが記録され得る:
2016-09-16 16:18:28.470 -05:00 [Debug] Start client validation
2016-09-16 16:18:28.470 -05:00 [Debug] Start parsing Basic Authentication secret
2016-09-16 16:18:28.470 -05:00 [Debug] Parser found secret: "BasicAuthenticationSecretParser"
w3wp.exe Information: 0 : 2016-09-16 16:18:28.470 -05:00 [Information] Secret id found: "client"
2016-09-16 16:18:28.470 -05:00 [Debug] No matching hashed secret found.
w3wp.exe Information: 0 : 2016-09-16 16:18:28.470 -05:00 [Information] Secret validators could not validate secret
w3wp.exe Information: 0 : 2016-09-16 16:18:28.470 -05:00 [Information] Client validation failed.
w3wp.exe Information: 0 : 2016-09-16 16:18:28.470 -05:00 [Information] End token request
w3wp.exe Information: 0 : 2016-09-16 16:18:28.470 -05:00 [Information] Returning error: invalid_client
私はバリの秘密を検証することができない理由は本当にわかりません。 Sha256とIdentityServerがSha256を解析して検証できるように、データベースに保存されます。
UPDATE: 私はそれがポストマンからのPOSTを行うと、適切なx-www-form-urlencodedでフィールドを記入動作するようになったが、私はまだそれが認証を使用して動作するように取得する方法を考え出したていませんタブと「郵便配達員の新しいアクセストークンの取得」機能を使用します。 IdentityServer3からアクセストークンを取得するために使用することはできませんか?
私はクライアントのリダイレクトurisにコールバックURLを追加しました。トークン名を「ベアラ」に更新しました。 Auth URLを承認エンドポイントに変更しました。 (私の付与タイプは依然としてクライアント証明書です)。私はRequest accessトークンをローカルチェックボックスにチェックして、このメソッドを使って "invalid_client"を取得します...クライアントは "Authorization Code"フローでセットアップする必要がありますか? –
クライアントクレデンシャルとリソースコードを使用して動作させていただきました。唯一の違いはリソースコードです。Postmanはログインダイアログをポップアップします。これは、多くのRESTサービス呼び出しを特定のユーザーに関連付ける必要があるため、私が働いている開発に便利です。 – GlennSills