List of usage examples for javax.security.sasl AuthorizeCallback AuthorizeCallback
public AuthorizeCallback(String authnID, String authzID)
From source file:com.delphix.session.impl.sasl.PlainSaslServer.java
@Override protected byte[] evaluate(byte[] message) throws SaslException { // Parse the SASL message String[] userInfo = parse(message); // Perform authentication String prompt = getMechanismName() + " authentication ID: "; NameCallback nc = new NameCallback(prompt, userInfo[1]); AuthenticateCallback ac = new AuthenticateCallback(userInfo[2]); invokeCallbacks(nc, ac);/*from w w w . j a v a 2 s .c o m*/ if (!ac.isAuthenticated()) { throw new SaslException("sasl authentication failed"); } // Perform authorization AuthorizeCallback az = new AuthorizeCallback(userInfo[1], userInfo[0]); invokeCallbacks(az); if (az.isAuthorized()) { authorizationId = az.getAuthorizedID(); } else { throw new SaslException(); } // Mark the SASL server completed setComplete(); return null; }