maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
3 changed files with
32 additions and
2 deletions
-
framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
-
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs
-
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs
|
|
|
@ -400,6 +400,36 @@ public static class AbpStringExtensions |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static string ToSha256(this string str) |
|
|
|
{ |
|
|
|
using (var sha = SHA256.Create()) |
|
|
|
{ |
|
|
|
var data = sha.ComputeHash(Encoding.UTF8.GetBytes(str)); |
|
|
|
|
|
|
|
var sb = new StringBuilder(); |
|
|
|
foreach (var d in data) |
|
|
|
{ |
|
|
|
sb.Append(d.ToString("x2")); |
|
|
|
} |
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static string ToSha512(this string str) |
|
|
|
{ |
|
|
|
using (var sha = SHA512.Create()) |
|
|
|
{ |
|
|
|
var data = sha.ComputeHash(Encoding.UTF8.GetBytes(str)); |
|
|
|
|
|
|
|
var sb = new StringBuilder(); |
|
|
|
foreach (var d in data) |
|
|
|
{ |
|
|
|
sb.Append(d.ToString("x2")); |
|
|
|
} |
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Converts camelCase string to PascalCase string.
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
@ -24,6 +24,6 @@ public class IdentityModelDiscoveryDocumentCacheItem |
|
|
|
|
|
|
|
public static string CalculateCacheKey(IdentityClientConfiguration configuration) |
|
|
|
{ |
|
|
|
return configuration.Authority.ToLower().ToMd5(); |
|
|
|
return configuration.Authority.ToLower().ToSha256(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -21,6 +21,6 @@ public class IdentityModelTokenCacheItem |
|
|
|
|
|
|
|
public static string CalculateCacheKey(IdentityClientConfiguration configuration) |
|
|
|
{ |
|
|
|
return string.Join(",", configuration.Select(x => x.Key + ":" + x.Value)).ToMd5(); |
|
|
|
return string.Join(",", configuration.Select(x => x.Key + ":" + x.Value)).ToSha256(); |
|
|
|
} |
|
|
|
} |
|
|
|
|