Class WSCallbackHandlerImpl

java.lang.Object
com.ibm.websphere.security.auth.callback.WSCallbackHandlerImpl
All Implemented Interfaces:
CallbackHandler

public class WSCallbackHandlerImpl extends Object implements CallbackHandler

The WSCallbackHandlerImpl allows authentication data to be pushed to the login module, i.e. without prompting for the data.

Supported Callbacks:

  • javax.security.auth.callback.NameCallback
  • javax.security.auth.callback.PasswordCallback
  • com.ibm.websphere.security.auth.callback.WSCredTokenCallbackImpl
  • com.ibm.websphere.security.auth.callback.WSRealmNameCallbackImpl
  • com.ibm.wsspi.security.auth.callback.WSAppContextCallback

Since:
1.0
See Also:
  • Constructor Details

    • WSCallbackHandlerImpl

      public WSCallbackHandlerImpl(String userName, String password)

      Push the username and password to login module.

      Parameters:
      userName - The user name of the principal.
      password - The password in clear text.
    • WSCallbackHandlerImpl

      public WSCallbackHandlerImpl(String userName, String realmName, String password)

      Push the username and password to login module. The realmName is only need if it's different from the current realm. If you intend to login to the current realm, you do not need to specify a realm or you can specify the current realm.

      In the client container, the realm is ignored and instead the realm from the target server is used.

      Parameters:
      userName - The user name of the principal.
      realmName - The realm name, if different from the current realm; ignored on the client container
      password - The password in clear text.
    • WSCallbackHandlerImpl

      public WSCallbackHandlerImpl(String userName, String realmName, String password, Map appContext)

      Push the username and password to login module. The realmName is only needed if it's different from the current realm. If you intend to login to the current realm, you do not need to specify a realm or you can specify the current realm.

      If the realm you specify is different from the current realm and you want to validate the userid/password at the new target realm during this login, then you must specify a java.util.Map which contains the following properites: javax.naming.Context.PROVIDER_URL Example: "corbaloc:iiop:myhost.mycompany.com:2809" javax.naming.Context.INITIAL_CONTEXT_FACTORY Example: "com.ibm.websphere.naming.WsnInitialContextFactory" Note: If the target server is not a WebSphere server, then do not specify this information since it will not validate successfully. Also, the target server must support CSIv2 in order for the userid/password to be successfully sent.

      In the client container, the realm is ignored and instead the realm from the target server is used.

      Parameters:
      userName - The user name of the principal.
      realmName - The realm name, if different from the current realm; ignored on the client container
      password - The password in clear text.
      appContext - A java.util.Map containing naming properties to validate userid/password.
    • WSCallbackHandlerImpl

      public WSCallbackHandlerImpl(byte[] credToken)

      Push Credential Token to login module. The Credential Token should be treated as an opaque object. The credential token must be in the format recognized by WebSphere Secure Association Service.

      Parameters:
      credToken - The credential token.
  • Method Details

    • handle

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

      This implementation of CallbackHandler pushes the data specified in the constructor to the login module.

      Specified by:
      handle in interface CallbackHandler
      Parameters:
      callbacks - An array of Callback objects provided by the underlying security service which contains the information requested to be retrieved or displayed.
      Throws:
      IOException - If an input or output error occurs.
      UnsupportedCallbackException - If the implementation of this method does not support one or more of the Callbacks specified in the callbacks parameter.