Ben Clifford

Use Active Directory Credentials with HCP and the AWS Java SDK: A Working Example

Blog Post created by Ben Clifford Employee on Nov 1, 2018

The AWS Java SDK does not natively support Active Directory authentication, but it is flexible enough that with a very little bit of coding you can use your AD credentials with HCP over the HS3 gateway.


Attached is a working code example that uses active directory credentials to interface with HCP using the AWS Java SDK. This is not intended to be a general S3 programming example (for that see HCP S3 Code Sample), but is strictly intended to demonstrate how to use AD with HCP and the AWS Java SDK. This is intended for an audience that is already familiar with AWS Java SDK programming.


In order for this to work you will need to be on HCP version 8.0 or higher. You cannot create a bucket(namespace) with the AD user so you will need to create the namespace by other means. To give the AD user privileges in the namespace, you must assign data access permissions to an AD group to which the user belongs. Setting the AD user to be the owner of the bucket does not provide any data access privileges, but is required if you wish to see the buckets you own in an endpoint listing.