public static PluginAuthInfo Create(AuthInfo authInfo, string realmName) { return(new PluginAuthInfo(authInfo.Principal(), realmName, new HashSet <>(authInfo.Roles()))); }
public static PluginAuthInfo CreateCacheable(AuthInfo authInfo, string realmName, SecureHasher secureHasher) { if (authInfo is CacheableAuthInfo) { sbyte[] credentials = (( CacheableAuthInfo )authInfo).credentials(); SimpleHash hashedCredentials = secureHasher.Hash(credentials); return(new PluginAuthInfo(authInfo, hashedCredentials, realmName)); } else { return(new PluginAuthInfo(authInfo.Principal(), realmName, new HashSet <>(authInfo.Roles()))); } }
private PluginAuthInfo(AuthInfo authInfo, SimpleHash hashedCredentials, string realmName) : this(authInfo.Principal(), hashedCredentials.Bytes, hashedCredentials.Salt, realmName, new HashSet <string>(authInfo.Roles())) { }