All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.security.auth.message.callback.SecretKeyCallback Maven / Gradle / Ivy

The newest version!
package javax.security.auth.message.callback;

import javax.security.auth.callback.Callback;

//$Id$

/**
 *  

Callback for acquiring a shared secret from a key repository. This Callback may be used by client or server * authentication modules to obtain shared secrets (for example, passwords) without relying on a user during the * Callback processing. This Callback is typically employed by ClientAuthModules invoked from * intermediate components that need to acquire a password to authenticate to their target service.

* * @author Anil Saldhana * @author Charlie Lai, Ron Monzillo (Javadoc for JSR-196) * @since May 11, 2006 * @version $Revision$ */ public class SecretKeyCallback implements Callback { /** *

Marker interface for secret key request types.

*/ public static interface Request { } /** *

Request type for secret keys that are identified via an alias.

*/ public static class AliasRequest implements Request { private String alias = "Alias"; /** * *

Construct an AliasRequest with an alias.

* *

The alias is used to directly identify the secret key to be returned.

* *

If the alias is null, the handler of the callback relies on its own default.

* * @param alias Name identifier for the secret key, or null */ public AliasRequest(String alias) { if(alias != null) this.alias = alias; } /** *

Get the alias.

* * @return The alias, or null. */ public String getAlias() { return alias; } } private Request request; private javax.crypto.SecretKey key; /** *

Constructs this SecretKeyCallback with a secret key Request object.

* *

The request object identifies the secret key to be returned. If the alias is null, the handler of the callback * relies on its own default.

* * @param request Request object identifying the secret key, or null. */ public SecretKeyCallback(SecretKeyCallback.Request request) { this.request = request; } /** *

Used by the CallbackHandler to get the Request object which identifies the secret key to be returned.

* * @return The Request object which identifies the private key to be returned, or null. If null, the handler of * the callback relies on its own default. */ public Request getRequest() { return request; } /** *

Used by the CallbackHandler to set the requested secret key within the Callback.

* * @param key The secret key, or null if no key was found. */ public void setKey(javax.crypto.SecretKey key) { this.key = key; } /** *

Used to obtain the secret key set within the Callback.

* * @return The secret key, or null if no key was found. */ public javax.crypto.SecretKey getKey() { return key; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy