org.apache.ws.security
Class WSPasswordCallback

java.lang.Object
  extended byorg.apache.ws.security.WSPasswordCallback
All Implemented Interfaces:
javax.security.auth.callback.Callback

public class WSPasswordCallback
extends java.lang.Object
implements javax.security.auth.callback.Callback

Simple class to provide a password callback mechanism.

It uses the JAAS authentication mechanisms and callback methods. In addition to the identifier (user name) this class also provides information what type of information the callback handle method shall provide.

The WSPasswordCallback class defines the following usage codes:

Author:
Werner Dittmann (Werner.Dittmann@siemens.com).

Field Summary
static int CUSTOM_TOKEN
           
static int DECRYPT
           
static int ENCRYPTED_KEY_TOKEN
           
static int KEY_NAME
           
static int SECURITY_CONTEXT_TOKEN
           
static int SIGNATURE
           
static int UNKNOWN
           
static int USERNAME_TOKEN
           
static int USERNAME_TOKEN_UNKNOWN
           
 
Constructor Summary
WSPasswordCallback(java.lang.String id, int usage)
          Constructor.
WSPasswordCallback(java.lang.String id, java.lang.String pw, java.lang.String type, int usage)
          Constructor.
 
Method Summary
 org.w3c.dom.Element getCustomToken()
           
 java.lang.String getIdentifer()
          Deprecated. use getIdentifier() instead
 java.lang.String getIdentifier()
          Get the identifier.
 byte[] getKey()
          Get the key.
 java.lang.String getPassword()
          Get the password.
 java.lang.String getPasswordType()
          The password type is only relevant for usage USERNAME_TOKEN and USERNAME_TOKEN_UNKNOWN.
 int getUsage()
          Get the usage.
 void setCustomToken(org.w3c.dom.Element customToken)
           
 void setIdentifier(java.lang.String ident)
          Extended callback interface allows for setting the username as well.
 void setKey(byte[] key)
          Set the Key.
 void setPassword(java.lang.String passwd)
          Set the password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

DECRYPT

public static final int DECRYPT
See Also:
Constant Field Values

USERNAME_TOKEN

public static final int USERNAME_TOKEN
See Also:
Constant Field Values

SIGNATURE

public static final int SIGNATURE
See Also:
Constant Field Values

KEY_NAME

public static final int KEY_NAME
See Also:
Constant Field Values

USERNAME_TOKEN_UNKNOWN

public static final int USERNAME_TOKEN_UNKNOWN
See Also:
Constant Field Values

SECURITY_CONTEXT_TOKEN

public static final int SECURITY_CONTEXT_TOKEN
See Also:
Constant Field Values

CUSTOM_TOKEN

public static final int CUSTOM_TOKEN
See Also:
Constant Field Values

ENCRYPTED_KEY_TOKEN

public static final int ENCRYPTED_KEY_TOKEN
See Also:
Constant Field Values
Constructor Detail

WSPasswordCallback

public WSPasswordCallback(java.lang.String id,
                          int usage)
Constructor.

Parameters:
id - The application called back must supply the password for this identifier.

WSPasswordCallback

public WSPasswordCallback(java.lang.String id,
                          java.lang.String pw,
                          java.lang.String type,
                          int usage)
Constructor.

Parameters:
id - The application called back must supply the password for this identifier.
Method Detail

getIdentifier

public java.lang.String getIdentifier()
Get the identifier.

Returns:
The identifier

getIdentifer

public java.lang.String getIdentifer()
Deprecated. use getIdentifier() instead

Get the identifier.

Returns:
The identifier

setIdentifier

public void setIdentifier(java.lang.String ident)
Extended callback interface allows for setting the username as well. Callback functions can change the identifier, this is intended in the usernametoken scenario where the usernametoken denotes the identity, but a fixed identity for signing is used The initial value is that from the configuration file. If this method is not called, the configured identity is used.

Parameters:
ident - The identity.

setPassword

public void setPassword(java.lang.String passwd)
Set the password.

Parameters:
passwd - is the password associated to the identifier

getPassword

public java.lang.String getPassword()
Get the password.

Returns:
The password

setKey

public void setKey(byte[] key)
Set the Key.

Parameters:
key - is the key associated to the identifier

getKey

public byte[] getKey()
Get the key.

Returns:
The key

getUsage

public int getUsage()
Get the usage.

Returns:
The usage for this callback

getPasswordType

public java.lang.String getPasswordType()
The password type is only relevant for usage USERNAME_TOKEN and USERNAME_TOKEN_UNKNOWN.

Returns:
Returns the passwordType.

getCustomToken

public org.w3c.dom.Element getCustomToken()

setCustomToken

public void setCustomToken(org.w3c.dom.Element customToken)


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.