//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateCorrectAuthenticationInfoFromCustomCacheable() public virtual void ShouldCreateCorrectAuthenticationInfoFromCustomCacheable() { SecureHasher hasher = mock(typeof(SecureHasher)); when(hasher.Hash(any())).thenReturn(new SimpleHash("some-hash")); PluginAuthenticationInfo internalAuthInfo = PluginAuthenticationInfo.CreateCacheable(CustomCacheableAuthenticationInfo.of("thePrincipal", ignoredAuthToken => true), "theRealm", hasher); assertThat((IList <string>)internalAuthInfo.Principals.asList(), containsInAnyOrder("thePrincipal")); }
public static PluginAuthenticationInfo CreateCacheable(AuthenticationInfo authenticationInfo, string realmName, SecureHasher secureHasher) { if (authenticationInfo is CustomCacheableAuthenticationInfo) { CustomCacheableAuthenticationInfo info = ( CustomCacheableAuthenticationInfo )authenticationInfo; return(new PluginAuthenticationInfo(authenticationInfo.Principal(), realmName, info.CredentialsMatcher())); } else if (authenticationInfo is CacheableAuthenticationInfo) { sbyte[] credentials = (( CacheableAuthenticationInfo )authenticationInfo).credentials(); SimpleHash hashedCredentials = secureHasher.Hash(credentials); return(PluginAuthenticationInfo.Create(authenticationInfo, hashedCredentials, realmName)); } else { return(PluginAuthenticationInfo.Create(authenticationInfo, realmName)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateCorrectAuthenticationInfo() public virtual void ShouldCreateCorrectAuthenticationInfo() { PluginAuthenticationInfo internalAuthInfo = PluginAuthenticationInfo.CreateCacheable(AuthenticationInfo.of("thePrincipal"), "theRealm", null); assertThat((IList <string>)internalAuthInfo.Principals.asList(), containsInAnyOrder("thePrincipal")); }