Java Application Password SDK
This topic describes the Java Application Password SDK for the Credential Provider.
This version of Credential Providers (CP) works with CP SDKs v 12.1 and later.
If you are working with:
-
CP SDKs 12.0 or earlier, these must be replaced with the latest CP SDKs
-
CP SDKs v12.1 or later, but not the latest CP SDKs, we strongly recommend replacing them with the latest CP SDKs
For examples, syntax, and exceptions, see Examples, syntax, and exceptions - Java.
Supported platforms
The Java SDK for the Credential Provider can be used from Java and web applications.
It is implemented as a jar file that contains several classes that allow you to communicate with the Credential Provider.
For a full list of supported platforms for which the Java Application Password SDK for the Credential Provider is released, see Application Password SDKs.
Set up the Java Application Password SDK
The Java Application Password SDK works only with the JVM default class loader. It does not support custom class loaders. |
-
Specify the location of the Java SDK file:
Windows In the CLASSPATH, specify the location of JavaPasswordSDK.jar UNIX In the CLASSPATH, specify the location of javapasswordsdk.jar For more information about setting up the environment before using the SDK, refer to Build the environment for the Credential Provider.
-
On JVM 1.6 and later, the Java Application Password SDK relies on the (Java Cryptographic Extension) JCE Unlimited Strength Jurisdiction Policy Files. Download this extension from the Java site.
If you are using custom java.security configuration, make sure that a custom security provider is not specified before com.sun.crypto.provider.SunJCE.
Use the Java Application Password SDK in your code
This section describes how to set up the Java Application Password SDK in your code so that your application can retrieve passwords.
-
Import JavaPasswordSDK.* and JavaPasswordSDK.Exceptions.*.
-
Declare an object of type
PSDKPasswordRequest
class. -
Declare an object of type
PSDKPassword
class. -
Instantiate the
PSDKPasswordRequest
object. -
Set all the required request properties. For example,
PSDKPasswordRequest.setAppID(<app-id>)
-
Run the
PasswordSDK.getPassword(PSDKPasswordRequest)
method. -
Assign the result to the
PSDKPassword
object.For information about enabling trace logs for password requests, refer to Troubleshooting the Java application password SDK.
-
Retrieve the required information from the password object. For example, to retrieve the password content, use the
getSecureContent()
method of thePSDKPassword
class. -
Retrieve any additional property you need, such as the username and/or address of the account the application accesses.
-
Clear sensitive content from memory, as described in getSecureContent, and dispose the object.