Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.server.security.enterprise.auth.plugin.spi.AuthInfo authenticateAndAuthorize(org.neo4j.server.security.enterprise.auth.plugin.api.AuthToken authToken) throws org.neo4j.server.security.enterprise.auth.plugin.api.AuthenticationException
        public override AuthInfo AuthenticateAndAuthorize(AuthToken authToken)
        {
            try
            {
                string username = authToken.Principal();
                char[] password = authToken.Credentials();

                LdapContext   ctx   = Authenticate(username, password);
                ISet <string> roles = Authorize(ctx, username);

                return(AuthInfo.of(username, roles));
            }
            catch (NamingException e)
            {
                throw new AuthenticationException(e.Message);
            }
        }