public override AuthenticationInfo Authenticate(AuthToken authToken) { string principal = authToken.Principal(); char[] credentials = authToken.Credentials(); if (principal.Equals("neo4j") && Arrays.Equals(credentials, "neo4j".ToCharArray())) { return(AuthenticationInfo.of("neo4j")); } else if (principal.Equals("authorization_expired_user") && Arrays.Equals(credentials, "neo4j".ToCharArray())) { return(( AuthenticationInfo )() => "authorization_expired_user"); } return(null); }
//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); } }
public override bool DoCredentialsMatch(AuthToken authToken) { return(Arrays.Equals(authToken.Credentials(), Credentials)); }
public override AuthenticationInfo Authenticate(AuthToken authToken) { string username = ValidateCredentials(authToken.Credentials()); return(new AuthenticationInfo(this, username, authToken.Credentials())); }