Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.kie.remote.services.jms.security;
 
 
This is the basic, default implementation of a User/Pass callback handler for a JAAS login. This class is used by the JMS org.kie.remote.services.jms.RequestMessageBean in order to retrieve the subject for the user/pass info stored in a message (the Bean itself runs as an anonymous user).
public class UserPassCallbackHandler implements CallbackHandler {
    private final String[] credentials;
    public UserPassCallbackHandler(String[] credentials) {
        this. = credentials;
    }
    @Override
    public void handle(Callback[] callbacksthrows IOExceptionUnsupportedCallbackException {
        for (Callback current : callbacks) {
            if (current instanceof NameCallback) {
                NameCallback ncb = (NameCallbackcurrent;
                ncb.setName([0]);
            } else if (current instanceof PasswordCallback) {
                PasswordCallback pcb = (PasswordCallbackcurrent;
                pcb.setPassword([1].toCharArray());
            } else if (current instanceof RealmCallback) {
                RealmCallback realmCallback = (RealmCallbackcurrent;
                realmCallback.setText(realmCallback.getDefaultText());
            } else {
                throw new UnsupportedCallbackException(current);
            }
        }
    }
New to GrepCode? Check out our FAQ X