//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);
            }
        }