org.apache.jetspeed.security.impl
Class PassiveCallbackHandler

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

public class PassiveCallbackHandler
extends java.lang.Object
implements javax.security.auth.callback.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

Constructor Summary
PassiveCallbackHandler(java.lang.String username, java.lang.String password)
          Creates a callback handler with the give username and password.
 
Method Summary
 void clearPassword()
          Clears out password state.
 void handle(javax.security.auth.callback.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
 

Constructor Detail

PassiveCallbackHandler

public PassiveCallbackHandler(java.lang.String username,
                              java.lang.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(javax.security.auth.callback.Callback[] callbacks)
            throws java.io.IOException,
                   javax.security.auth.callback.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 javax.security.auth.callback.CallbackHandler
Parameters:
callbacks - the callbacks to handle
Throws:
IOException - if an input or output error occurs.
javax.security.auth.callback.UnsupportedCallbackException - if the callback is not an instance of NameCallback or PasswordCallback

clearPassword

public void clearPassword()

Clears out password state.



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