aio-lib-java-ims is an Adobe I/O - Java SDK - IMS Library.
This Java library wraps http API endpoints exposed by
Adobe Identity Management System (IMS)
A Service Account connection allows your application to call Adobe services on behalf of the application itself or on behalf of an enterprise organization.
For this type of connection, you will create a JSON Web Token (JWT) that encapsulates your credentials and begin each API session by exchanging the JWT for an access token.
The JWT encodes all of the identity and security information required to obtain an access token and must be signed with the private key that is associated with a public key certificate specified on your integration.
This Java library will help you implement this JWT exchange token flow, to get a valid access token and start interacting with the many Adobe I/O API that support such authentication.
PrivateKey privateKey = new PrivateKeyBuilder().systemEnv().build(); // [1]
Workspace workspace = Workspace.builder()
.systemEnv()
.privateKey(privateKey)
.build(); // [2]
ImsService imsService = ImsService.builder().workspace(workspace).build(); // [3]
AccessToken accessToken = imsService.getJwtExchangeAccessToken(); // [4]
// [1] Build your PrivateKey looking up the key indicated by you System Environment variables
// [2] build your `Workspace` (a Java POJO representation of your `Adobe Developer Console` Workspace)
// looking up other System Environment variables.
// Note that our fluent workspace and private Key builders offers many ways to have your workspace configured,
// we are showing here the most concise
// [3] build the Ims Service wrapper and have it use this workspace context
// [4] use this service to retrieve an access token using a jwt exchange token flow
Have a look at our ImsService main() Test Drive
Browse our Service Account Integration (JWT authentication flow) doc,
our fluent workspace builder offers many ways to have your Workspace (a Java POJO representation of your Adobe Developer Console Workspace) configured.
To get you started quickly you could use a .properties file,
see our sample config file
First, use openssl to create an RSA private/public certificate pair
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate_pub.crt
Our PrivateKeyBuilder
offer 3 options to configure/use this privateKey:
- Option 1: use a pcks8 file
- Option 2: use a base 64 encoded pcks8 key
- Option 3: use a keystore
For option 1, to convert your private key to a PKCS8 format, use the following command:
openssl pkcs8 -topk8 -inform PEM -outform DER -in private.key -nocrypt > private.pkcs8.key
For option 2, to base 64 encode it, use the following command:
base64 private.pkcs8.key
For option 3, Use the following commands to set the alias (as myalias here) and a non-empty keystore password.
cat private.key certificate_pub.crt > private-key-crt
openssl pkcs12 -export -in private-key-crt -out keystore.p12 -name myalias -noiter -nomaciter
This lib also contains JWT (exchange token flow) Authentication RequestInterceptor: JWTAuthInterceptor
It is a Open Feign RequestInterceptor.
It can be leverage to add the authentication headers expected by many Adobe APIs, it will add
- an
Authorizationheader with aBeareraccess token (generated from a JWT exchange flow)- renewing it only when expired (after 24 hours) or when not present in memory yet
- a
x-api-keyheader matching your JWT token
This Library is build with maven (it also runs the unit tests):
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.