public class WSPasswordCallback extends Object implements javax.security.auth.callback.Callback
handle
method shall provide.
The WSPasswordCallback
class defines the following usage
codes:
UNKNOWN
- an unknown usage. Never used by the WSS4J
implementation and shall be treated as an error by the handle
method.DECRYPT
- need a password to get the private key of
this identifier (username) from the keystore. WSS4J uses this private
key to decrypt the session (symmetric) key. Because the encryption
method uses the public key to encrypt the session key it needs no
password (a public key is usually not protected by a password).USERNAME_TOKEN
- need the password to fill in or to
verify a UsernameToken
.SIGNATURE
- need the password to get the private key of
this identifier (username) from the keystore. WSS4J uses this private
key to produce a signature. The signature verification uses the public
key to verify the signature.KEY_NAME
- need the key, not the password,
associated with the identifier. WSS4J uses this key to encrypt or
decrypt parts of the SOAP request. Note, the key must match the
symmetric encryption/decryption algorithm specified (refer to
WSHandlerConstants.ENC_SYM_ALGO
).USERNAME_TOKEN_UNKNOWN
- either an not specified
password type or a password type passwordText. In these both cases only
the password variable is set. The callback class now may check if
the username and password match. If they don't match the callback class must
throw an exception. The exception can be a UnsupportedCallbackException or
an IOException.SECURITY_CONTEXT_TOKEN
- need the key to to be associated
with a wsc:SecurityContextToken
.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
WSPasswordCallback(String id,
int usage)
Constructor.
|
WSPasswordCallback(String id,
String pw,
String type,
int usage)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Element |
getCustomToken() |
String |
getIdentifer()
Deprecated.
use getIdentifier() instead
|
String |
getIdentifier()
Get the identifier.
|
byte[] |
getKey()
Get the key.
|
String |
getKeyType()
The key type is only relevant for usage
ENCRYPTED_KEY_TOKEN |
String |
getPassword()
Get the password.
|
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(String ident)
Extended callback interface allows for setting the username as well.
|
void |
setKey(byte[] key)
Set the Key.
|
void |
setPassword(String passwd)
Set the password.
|
public static final int UNKNOWN
public static final int DECRYPT
public static final int USERNAME_TOKEN
public static final int SIGNATURE
public static final int KEY_NAME
public static final int USERNAME_TOKEN_UNKNOWN
public static final int SECURITY_CONTEXT_TOKEN
public static final int CUSTOM_TOKEN
public static final int ENCRYPTED_KEY_TOKEN
public WSPasswordCallback(String id, int usage)
id
- The application called back must supply the password for
this identifier.public String getIdentifier()
public String getIdentifer()
public void setIdentifier(String ident)
ident
- The identity.public void setPassword(String passwd)
passwd
- is the password associated to the identifierpublic String getPassword()
public void setKey(byte[] key)
key
- is the key associated to the identifierpublic byte[] getKey()
public int getUsage()
public String getPasswordType()
USERNAME_TOKEN
and USERNAME_TOKEN_UNKNOWN
.public String getKeyType()
ENCRYPTED_KEY_TOKEN
public org.w3c.dom.Element getCustomToken()
public void setCustomToken(org.w3c.dom.Element customToken)
Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.