List of usage examples for javax.security.sasl AuthorizeCallback setAuthorized
public void setAuthorized(boolean ok)
From source file:org.apache.hadoop.io.crypto.bee.key.sasl.KeySaslServer.java
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof RealmCallback) { // do your business } else if (callback instanceof NameCallback) { // do your business } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(new String(keyToken.getPassword()).toCharArray()); // logger.debug("set password:" + // Hex.encodeHexString(keyToken.getPassword())); } else if (callback instanceof AuthorizeCallback) { // logger.debug("set authorized to true"); AuthorizeCallback authCallback = ((AuthorizeCallback) callback); authCallback.setAuthorized(true); } else {//from w w w . j av a 2s. c om // logger.error(callback.getClass().getName()); throw new UnsupportedCallbackException(callback, "Unrecognized Callback"); } } }