org.apache.jetspeed.security.impl
Class PassiveCallbackHandler

java.lang.Object
  extended by org.apache.jetspeed.security.impl.PassiveCallbackHandler
All Implemented Interfaces:
CallbackHandler

public class PassiveCallbackHandler
extends Object
implements CallbackHandler

PassiveCallbackHandler has constructor that takes a username and password so its handle() method does not have to prompt the user for input.

Useful for server-side applications.

This code was inspired from an article from:

*

Author:
David Le Strat

Field Summary
(package private)  char[] password
           
private  String username
           
 
Constructor Summary
PassiveCallbackHandler(String username, String password)
          Creates a callback handler with the give username and password.
 
Method Summary
 void clearPassword()
          Clears out password state.
 void handle(Callback[] callbacks)
          Handles the specified set of Callbacks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

username

private String username

password

char[] password
Constructor Detail

PassiveCallbackHandler

public PassiveCallbackHandler(String username,
                              String password)

Creates a callback handler with the give username and password.

Parameters:
username - The username.
password - The password.
Method Detail

handle

public void handle(Callback[] callbacks)
            throws IOException,
                   UnsupportedCallbackException

Handles the specified set of Callbacks. Uses the username and password that were supplied to our constructor to popluate the Callbacks.

This class supports NameCallback and PasswordCallback.

Specified by:
handle in interface CallbackHandler
Parameters:
callbacks - the callbacks to handle
Throws:
IOException - if an input or output error occurs.
UnsupportedCallbackException - if the callback is not an instance of NameCallback or PasswordCallback

clearPassword

public void clearPassword()

Clears out password state.



Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.