When creating a new SigningCredentials
instance the second constructor parameter is the signatureAlgorithm
of type string
.
You don't have to use your own magic string, you can use static SecurityAlgorithms
class e.g. SecurityAlgorithms.HmacSha256Signature
.
I read the algorithm from a config file and want to validate this string. This string should contain a valid signatureAlgorithm
. Is there a simple way I could say
(Pseudo Code)
if (SecurityAlgorithms.Contains(identitySettings.TokenSignatureAlgorithm))
{
// validation failed
}
so that one is not able to configure crap like identitySettings.TokenSignatureAlgorithm = "this is no algorithm";