//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogSuccessfulAuthenticationQueriesUsingStartTLS() throws javax.naming.NamingException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogSuccessfulAuthenticationQueriesUsingStartTLS() { // Given when(Config.get(SecuritySettings.ldap_use_starttls)).thenReturn(true); LdapRealm realm = new TestLdapRealm(this, Config, _securityLog, false); JndiLdapContextFactory jndiLdapContectFactory = mock(typeof(JndiLdapContextFactory)); when(jndiLdapContectFactory.Url).thenReturn("ldap://myserver.org:12345"); // When realm.QueryForAuthenticationInfo(new ShiroAuthToken(map("principal", "olivia", "credentials", "123")), jndiLdapContectFactory); // Then verify(_securityLog).debug(contains("{LdapRealm}: Authenticated user 'olivia' against 'ldap://myserver.org:12345' using StartTLS")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogFailedAuthenticationQueries() public virtual void ShouldLogFailedAuthenticationQueries() { // Given when(Config.get(SecuritySettings.ldap_use_starttls)).thenReturn(true); LdapRealm realm = new TestLdapRealm(this, Config, _securityLog, true); JndiLdapContextFactory jndiLdapContectFactory = mock(typeof(JndiLdapContextFactory)); when(jndiLdapContectFactory.Url).thenReturn("ldap://myserver.org:12345"); // When assertException(() => realm.QueryForAuthenticationInfo(new ShiroAuthToken(map("principal", "olivia", "credentials", "123")), jndiLdapContectFactory), typeof(NamingException)); // Then // Authentication failures are logged from MultiRealmAuthManager //verify( securityLog ).error( contains( // "{LdapRealm}: Failed to authenticate user 'olivia' against 'ldap://myserver.org:12345' using StartTLS: " + // "Simulated failure" ) ); }