Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7022776
Try with user & password
rani-sharim Mar 6, 2022
75eacab
Without env var
rani-sharim Mar 6, 2022
e593b68
TRy again
rani-sharim Mar 6, 2022
8ec6695
TRy upload
rani-sharim Mar 6, 2022
f92d2d4
TRy with subrepository
rani-sharim Mar 6, 2022
1ad3604
Differant repo
rani-sharim Mar 6, 2022
a89d740
Try update with version
rani-sharim Mar 6, 2022
e295059
Another shot at version
rani-sharim Mar 6, 2022
fccb317
Try tag
rani-sharim Mar 6, 2022
1c24b03
Another release try
rani-sharim Mar 6, 2022
f40e3cb
Handle subfolder
rani-sharim Mar 6, 2022
99cf766
v0.1.4
rani-sharim Mar 6, 2022
647f2e4
Refactor to add namespace
rani-sharim Mar 6, 2022
53a36fe
Add build to include jars
rani-sharim Mar 6, 2022
286c9e9
version bump
rani-sharim Mar 6, 2022
5d415ad
Try auto versioning
rani-sharim Mar 6, 2022
b47c3b6
Try one assembly
rani-sharim Mar 6, 2022
d70dd86
Try without ver in filename
rani-sharim Mar 6, 2022
80568a0
Another try
rani-sharim Mar 6, 2022
b997bb4
Added readme file
rani-sharim Mar 6, 2022
3231053
Add publish instructions
rani-sharim Mar 6, 2022
42a14f0
Update readme with akeyless sdk dependancy
rani-sharim Mar 6, 2022
8d65a8e
Update README.md
renanaAkeyless Mar 6, 2022
ba386d5
push pom alongside jar
rani-sharim Aug 16, 2022
a6d136a
hack to create pom file
rani-sharim Aug 17, 2022
8ad5f1c
Upgrade jackson-databind package to version 2.14.0
alikdolg Jun 21, 2024
89b9fba
Merge pull request #1 from akeylesslabs/increase-databind-core-packag…
alikdolg Jul 8, 2024
87f9e74
Adding security_pr_scanner.yml for security checks.
or-akl Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Java CI

on: [workflow_dispatch]

on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -14,10 +15,11 @@ jobs:
java-version: '8'
distribution: 'adopt'
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
run: mvn -Drevision=${{github.ref_name}} --batch-mode --update-snapshots verify
- uses: jfrog/setup-jfrog-cli@v1
env:
JF_ARTIFACTORY_1: ${{ secrets.ARTIFACTORY_ACCESS_KEY }}
- run: |
# Ping the server
jfrog rt ping
mkdir ${{github.ref_name}}
cp target/*.jar ${{github.ref_name}}/.
jfrog rt u "${{github.ref_name}}/*.jar" akeyless-java/io/akeyless/cloudid/${{github.ref_name}}/ --url=https://akeyless.jfrog.io/artifactory --user=ci-user --password=${{ secrets.ARTIFACTORY_ACCESS_KEY }}
sed "s/\${revision}/${{github.ref_name}}/g" pom.xml >> target/cloudid-${{github.ref_name}}.pom
jfrog rt u "${{github.ref_name}}/*.pom" akeyless-java/io/akeyless/cloudid/${{github.ref_name}}/ --url=https://akeyless.jfrog.io/artifactory --user=ci-user --password=${{ secrets.ARTIFACTORY_ACCESS_KEY }}
17 changes: 17 additions & 0 deletions .github/workflows/security_pr_scanner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Security PR Scan

on: [pull_request]

jobs:
Scanning_with:
uses: akeylesslabs/akeyless-security/.github/workflows/reusable-scanner.yaml@main
strategy:
fail-fast: false
matrix:
scan_type: ["SAST", "SCA"]
with:
branch_name: ${{ github.head_ref }}
repository_name: ${{ github.repository }}
event_name: ${{ github.event_name }}
scan_type: ${{ matrix.scan_type }}
secrets: inherit
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# akeyless-java-cloud-id

Akeyless CloudId Provider

The purpose of this package is to exteact the required "cloudid" to authenticate to akeyless using cloud authorization providers.

For more information, please visit [http://akeyless.io](http://akeyless.io)

## Publishing a new version
Tag the commit with a new tag and push to the repository.
The workflow will build and publish a new version to the artifactory repository.

## Requirements

Using the cloudid provider requires:
1. Java 1.8+
2. Maven/Gradle

## Installation

### Maven users

Add the following repository definition to your Maven settings file (default
`~/.m2/settings.xml`) or your POM file:

```xml
<repository>
<id>central</id>
<url>https://akeyless.jfrog.io/artifactory/akeyless-java</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
```

Add this dependency to your project's POM:

```xml
<dependency>
<groupId>io.akeyless</groupId>
<artifactId>cloudid</artifactId>
<version>Specify the CloudId package version here</version>
</dependency>
```
To use akeyless java sdk, you should also add:
```xml
<dependency>
<groupId>io.akeyless</groupId>
<artifactId>akeyless-java</artifactId>
<version>Specify the SDK version here</version>
</dependency>
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```java
import io.akeyless.client.ApiException;
import io.akeyless.cloudid.CloudProviderFactory;
import io.akeyless.cloudid.CloudIdProvider;

import io.akeyless.client.ApiClient;
import io.akeyless.client.Configuration;
import io.akeyless.client.model.*;
import io.akeyless.client.api.V2Api;

public class Main {
public static void main(String[] argv) {
// Use azure_ad/aws_iam/gcp, according to your cloud provider
String accessType = "azure_ad";
CloudIdProvider idProvider = CloudProviderFactory.getCloudIdProvider(accessType);
try {
String cloudId = idProvider.getCloudId();

ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.akeyless.io");

V2Api api = new V2Api(client);
Auth auth = new Auth();
auth.accessId("<Your auth method access id>");
auth.accessType(accessType);
auth.cloudId(cloudId);

AuthOutput result = api.auth(auth);


ListItems listBody = new ListItems();
listBody.setToken(result.getToken());
ListItemsInPathOutput listOut = api.listItems(listBody);
System.out.println(listOut.getItems().size());
} catch (ApiException e) {
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
} catch (Exception e) {
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
```

## Author
support@akeyless.io

1 change: 1 addition & 0 deletions cloudid.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
Expand Down
54 changes: 49 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.akeyless</groupId>
<artifactId>cloudid</artifactId>
<version>0.1.0</version>
<version>${revision}</version>
<packaging>jar</packaging>
<name>akeyless-cloud-id</name>
<url>https://github.com/akeylesslabs/akeyless-java-cloud-id</url>
Expand All @@ -31,6 +30,7 @@


<properties>
<fasterxml_version>2.14.0</fasterxml_version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
Expand All @@ -43,18 +43,39 @@
<version>1.5.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.1</version>
<artifactId>jackson-databind</artifactId>
<version>${fasterxml_version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>${fasterxml_version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.12.169</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand All @@ -65,4 +86,27 @@
<url>https://akeyless.jfrog.io/artifactory/akeyless-java</url>
</repository>
</distributionManagement>

<build>
<plugins>
<!-- any other plugins -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>
18 changes: 0 additions & 18 deletions src/main/java/io/akeyless/Main.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.akeyless;
package io.akeyless.cloudid;

import com.amazonaws.DefaultRequest;
import com.amazonaws.auth.AWS4Signer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.akeyless;
package io.akeyless.cloudid;

import java.io.InputStream;
import java.net.HttpURLConnection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.akeyless;
package io.akeyless.cloudid;

public interface CloudIdProvider {
String getCloudId() throws Exception;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.akeyless;
package io.akeyless.cloudid;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package io.akeyless;
package io.akeyless.cloudid;

import com.google.auth.oauth2.IdToken;
import com.google.auth.oauth2.IdTokenCredentials;
import com.google.auth.oauth2.IdTokenProvider;
import com.google.auth.oauth2.GoogleCredentials;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;

Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/META-INF/MANIFEST.MF

This file was deleted.