Intrspection - Secret validation is failing
Issue / Steps to reproduce the problem
I'm doing a proof of concept on ID4 (1.3.1) along with a trial copy of Admin UI. I have an ASP.Net Mvc client and a Web API 2 resource. I've chosen to issue reference tokens to the client and let the API exchange it to an access token using introspection end point. ( https://leastprivilege.com/2015/11/25/reference-tokens-and-introspection/).
When the secret is created using Admin UI (The secret value generated was '7d0c601ba0f44a70af6669c9212146ba'), the validation process fails with the error.
2017-07-21T08:14:11.9719982+08:00 0HL6F7QCIP04B [INF] Secret: "no description" uses invalid hashing algorithm. (d0a1d0e1)
Looks like the secret value generated by Admin UI is not a valid base64 string. Then I manually updated the secret value to be base64('secret') -> c2VjcmV0. But I still get the same error.
I beleive the error is being thrown here - https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Validation/HashedSharedSecretValidator.cs#L77
May be I'm missing something here, but appreciate if feedback can be provided.
Relevant parts of the log file
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [INF] Request starting HTTP/1.1 POST http://localhost:5000/connect/introspect application/x-www-form-urlencoded 70 (e5be5b71)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] AuthenticationScheme: "idsrv" was not authenticated. (1152f827)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] Request path "/connect/introspect" matched to endpoint type Introspection (b74352b0)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] Mapping found for endpoint: Introspection, creating handler: "IdentityServer4.Endpoints.IntrospectionEndpoint" (67a7e1a4)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [INF] Invoking IdentityServer endpoint: "IdentityServer4.Endpoints.IntrospectionEndpoint" for "/connect/introspect" (f7642de5)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] Starting introspection request. (3b4f5e67)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] Start parsing Basic Authentication secret (a451394d)
2017-07-21T08:18:46.6365994+08:00 0HL6F7QCIP04M [DBG] Parser found secret: "BasicAuthenticationSecretParser" (3b9cf89e)
2017-07-21T08:18:46.6371083+08:00 0HL6F7QCIP04M [DBG] Secret id found: "api1" (87dc2f0b)
2017-07-21T08:18:46.6371083+08:00 0HL6F7QCIP04M [DBG] Opening connection to database 'IdentityServer4.QuickStart.CustomUserStore' on server '(localdb)\mssqllocaldb'. (3b5ca34b)
2017-07-21T08:18:46.6376006+08:00 0HL6F7QCIP04M [INF] Executed DbCommand (0ms) [Parameters=[@__name_0='?' (Size = 200)], CommandType='Text', CommandTimeout='30']
SELECT TOP(1) [apiResource].[Id], [apiResource].[Description], [apiResource].[DisplayName], [apiResource].[Enabled], [apiResource].[Name]
FROM [ApiResources] AS [apiResource]
WHERE [apiResource].[Name] = @__name_0
ORDER BY [apiResource].[Id] (6438bdd5)
2017-07-21T08:18:46.6381006+08:00 0HL6F7QCIP04M [INF] Executed DbCommand (0ms) [Parameters=[@__name_0='?' (Size = 200)], CommandType='Text', CommandTimeout='30']
SELECT [a3].[Id], [a3].[ApiResourceId], [a3].[Type]
FROM [ApiClaims] AS [a3]
INNER JOIN (
SELECT DISTINCT TOP(1) [apiResource].[Id]
FROM [ApiResources] AS [apiResource]
WHERE [apiResource].[Name] = @__name_0
ORDER BY [apiResource].[Id]
) AS [apiResource2] ON [a3].[ApiResourceId] = [apiResource2].[Id]
ORDER BY [apiResource2].[Id] (6438bdd5)
2017-07-21T08:18:46.6386018+08:00 0HL6F7QCIP04M [INF] Executed DbCommand (0ms) [Parameters=[@__name_0='?' (Size = 200)], CommandType='Text', CommandTimeout='30']
SELECT [a2].[Id], [a2].[ApiResourceId], [a2].[Description], [a2].[Expiration], [a2].[Type], [a2].[Value]
FROM [ApiSecrets] AS [a2]
INNER JOIN (
SELECT DISTINCT TOP(1) [apiResource].[Id]
FROM [ApiResources] AS [apiResource]
WHERE [apiResource].[Name] = @__name_0
ORDER BY [apiResource].[Id]
) AS [apiResource1] ON [a2].[ApiResourceId] = [apiResource1].[Id]
ORDER BY [apiResource1].[Id] (6438bdd5)
2017-07-21T08:18:46.6386018+08:00 0HL6F7QCIP04M [INF] Executed DbCommand (0ms) [Parameters=[@__name_0='?' (Size = 200)], CommandType='Text', CommandTimeout='30']
SELECT [a].[Id], [a].[ApiResourceId], [a].[Description], [a].[DisplayName], [a].[Emphasize], [a].[Name], [a].[Required], [a].[ShowInDiscoveryDocument]
FROM [ApiScopes] AS [a]
INNER JOIN (
SELECT DISTINCT TOP(1) [apiResource].[Id]
FROM [ApiResources] AS [apiResource]
WHERE [apiResource].[Name] = @__name_0
ORDER BY [apiResource].[Id]
) AS [apiResource0] ON [a].[ApiResourceId] = [apiResource0].[Id]
ORDER BY [apiResource0].[Id], [a].[Id] (6438bdd5)
2017-07-21T08:18:46.6386018+08:00 0HL6F7QCIP04M [INF] Executed DbCommand (0ms) [Parameters=[@__name_0='?' (Size = 200)], CommandType='Text', CommandTimeout='30']
SELECT [a0].[Id], [a0].[ApiScopeId], [a0].[Type]
FROM [ApiScopeClaims] AS [a0]
INNER JOIN (
SELECT DISTINCT [apiResource0].[Id], [a].[Id] AS [Id0]
FROM [ApiScopes] AS [a]
INNER JOIN (
SELECT DISTINCT TOP(1) [apiResource].[Id]
FROM [ApiResources] AS [apiResource]
WHERE [apiResource].[Name] = @__name_0
ORDER BY [apiResource].[Id]
) AS [apiResource0] ON [a].[ApiResourceId] = [apiResource0].[Id]
) AS [a1] ON [a0].[ApiScopeId] = [a1].[Id0]
ORDER BY [a1].[Id], [a1].[Id0] (6438bdd5)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [DBG] Closing connection to database 'IdentityServer4.QuickStart.CustomUserStore' on server '(localdb)\mssqllocaldb'. (3b5ca34b)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [DBG] Found "api1" API resource in database (9da29aec)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [INF] Secret: "no description" uses invalid hashing algorithm. (d0a1d0e1)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [DBG] Secret validators could not validate secret (aed0bb6b)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [ERR] API validation failed. (45e28daa)
2017-07-21T08:18:46.6391138+08:00 0HL6F7QCIP04M [ERR] API unauthorized to call introspection endpoint. aborting. (ea68299d)
This seems to be an AdminUI issue. Please report that at RSK.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.