Created
February 11, 2019 09:50
-
-
Save sadrakgunadi/83e14d7ce65d2419db88cada84c075c7 to your computer and use it in GitHub Desktop.
Token Validation Parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TokenValidationParameters tvp = new TokenValidationParameters() { | |
ValidateActor = false, | |
// check the profile ID | |
ValidateAudience = true, | |
// check the client ID | |
ValidAudience = CLIENT_ID, | |
ValidateIssuer = true, | |
// check token came from Google | |
ValidIssuers = new List < string > { | |
"accounts.google.com", | |
"https://accounts.google.com" | |
}, | |
ValidateIssuerSigningKey = true, | |
RequireSignedTokens = true, | |
IssuerSigningKeys = certificates.Values.Select(x = >new X509SecurityKey(x)), | |
IssuerSigningKeyResolver = (token, securityToken, kid, validationParameters) = >{ | |
return certificates.Where(x = >x.Key.ToUpper() == kid.ToUpper()).Select(x = >new X509SecurityKey(x.Value)); | |
}, | |
ValidateLifetime = true, | |
RequireExpirationTime = true, | |
ClockSkew = TimeSpan.FromHours(13) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment