Hashing method IS4 uses?
This might be a silly question, but is there a way to know what is the hashing method IS4 uses to convert, for example, the refresh tokens when it saves them into the database? I would like to know if I can manually check string values to their hashed equivalents in the database.
is there a way to know what is the hashing method IS4 uses
Sure -- it is open source, after all :)
IIRC we use SHA256.
Thanks @brockallen , can you tell me if there is any method in IS4 available I can use to manually verify a string against its hashed record? Here is an example I have right now. The refresh token delivered to the client is "e0e11b2a9638fb4e275ffdb9826f9dea10f9a9775c3ef519404516801f0fdfa8" , and in the record saved in the database the key is "/7NVsiMBEGZQqauIAi0OCv96PofmKu9LdmY9wNABWuU=".
Is there a way I manually verify the former against the latter and get a true/false result?
This is the code you're looking for: https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Stores/Default/DefaultGrantStore.cs#L77
Thanks @brockallen , this is very interesting. Can I ask if there is a similar code block you can point at for hashing client secrets and saving them in the db?
This: https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Validation/HashedSharedSecretValidator.cs
I'll close this now, as the issue tracker is not a general Q&A board.
Thanks, well, I wonder if you can answer my very last question on this. If there is a way for me to verify my hashed string against this value in the database manually?
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.