//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static boolean processAuthentication(String userAgent, java.util.Map<String,Object> authToken, org.neo4j.bolt.runtime.StateMachineContext context) throws org.neo4j.bolt.runtime.BoltConnectionFatality public static bool ProcessAuthentication(string userAgent, IDictionary <string, object> authToken, StateMachineContext context) { try { BoltStateMachineSPI boltSpi = context.BoltSpi(); AuthenticationResult authResult = boltSpi.Authenticate(authToken); string username = authResult.LoginContext.subject().username(); context.AuthenticatedAsUser(username, userAgent); StatementProcessor statementProcessor = new TransactionStateMachine(boltSpi.TransactionSpi(), authResult, context.Clock()); context.ConnectionState().StatementProcessor = statementProcessor; if (authResult.CredentialsExpired()) { context.ConnectionState().onMetadata("credentials_expired", Values.TRUE); } context.ConnectionState().onMetadata("server", Values.stringValue(boltSpi.Version())); boltSpi.UdcRegisterClient(userAgent); return(true); } catch (Exception t) { context.HandleFailure(t, true); return(false); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldIndicateThatCredentialsExpired() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldIndicateThatCredentialsExpired() { // When AuthenticationResult result = _authentication.authenticate(map("scheme", "basic", "principal", "bob", "credentials", UTF8.encode("secret"))); // Then assertTrue(result.CredentialsExpired()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToUpdateExpiredCredentials() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToUpdateExpiredCredentials() { // When AuthenticationResult result = _authentication.authenticate(map("scheme", "basic", "principal", "bob", "credentials", UTF8.encode("secret"), "new_credentials", UTF8.encode("secret2"))); // Then assertThat(result.CredentialsExpired(), equalTo(false)); }