diff --git a/JWT/JWT.cs b/JWT/JWT.cs index 0a1e9a350..27cbb86cd 100755 --- a/JWT/JWT.cs +++ b/JWT/JWT.cs @@ -191,37 +191,37 @@ public static object DecodeToObject(string token, string key, bool verify = true var payloadJson = JsonWebToken.Decode(token, key, verify); var payloadData = JsonSerializer.Deserialize>(payloadJson); return payloadData; - } + } - /// - /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). - /// - /// The to return - /// The JWT. - /// The key that was used to sign the JWT. - /// Whether to verify the signature (default is true). - /// An object representing the payload. - /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. - public static T DecodeToObject(string token, byte[] key, bool verify = true) - { - var payloadJson = JsonWebToken.Decode(token, key, verify); - var payloadData = JsonSerializer.Deserialize(payloadJson); - return payloadData; - } + /// + /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). + /// + /// The to return + /// The JWT. + /// The key that was used to sign the JWT. + /// Whether to verify the signature (default is true). + /// An object representing the payload. + /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. + public static T DecodeToObject(string token, byte[] key, bool verify = true) + { + var payloadJson = JsonWebToken.Decode(token, key, verify); + var payloadData = JsonSerializer.Deserialize(payloadJson); + return payloadData; + } - /// - /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). - /// - /// The to return - /// The JWT. - /// The key that was used to sign the JWT. - /// Whether to verify the signature (default is true). - /// An object representing the payload. - /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. - public static T DecodeToObject(string token, string key, bool verify = true) - { - return DecodeToObject(token, Encoding.UTF8.GetBytes(key), verify); - } + /// + /// Given a JWT, decode it and return the payload as an object (by deserializing it with ). + /// + /// The to return + /// The JWT. + /// The key that was used to sign the JWT. + /// Whether to verify the signature (default is true). + /// An object representing the payload. + /// Thrown if the verify parameter was true and the signature was NOT valid or if the JWT was signed with an unsupported algorithm. + public static T DecodeToObject(string token, string key, bool verify = true) + { + return DecodeToObject(token, Encoding.UTF8.GetBytes(key), verify); + } private static JwtHashAlgorithm GetHashAlgorithm(string algorithm) {