Java Application Password SDK

This topic describes the Java Application Password SDK for the Credential Provider.

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.

  1. 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.

  2. 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.

  1. Import JavaPasswordSDK.* and JavaPasswordSDK.Exceptions.*.

  2. Declare an object of type PSDKPasswordRequest class.

  3. Declare an object of type PSDKPassword class.

  4. Instantiate the PSDKPasswordRequest object.

  5. Set all the required request properties. For example,

    PSDKPasswordRequest.setAppID(<app-id>)
  6. Run the PasswordSDK.getPassword(PSDKPasswordRequest) method.

  7. Assign the result to the PSDKPassword object.

    For information about enabling trace logs for password requests, refer to Troubleshooting the Java application password SDK.

  8. Retrieve the required information from the password object. For example, to retrieve the password content, use the getSecureContent() method of the PSDKPassword class.

  9. Retrieve any additional property you need, such as the username and/or address of the account the application accesses.

  10. Clear sensitive content from memory, as described in getSecureContent, and dispose the object.