From 0b0364718aa2c9820f982e279b65949c0ce430fe Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 17 Jan 2025 00:11:30 +0100 Subject: [PATCH 1/2] feat(auth): access token auth --- README.md | 12 +++++++++++- .../java/com/infisical/sdk/resources/AuthClient.java | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 45909e1..7784d44 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The SDK methods are organized into the following high-level categories: The `Auth` component provides methods for authentication: -#### Universal Auth +### Universal Auth #### Authenticating ```java @@ -86,10 +86,20 @@ sdk.Auth().UniversalAuthLogin( ); ``` + **Parameters:** - `clientId` (string): The client ID of your Machine Identity. - `clientSecret` (string): The client secret of your Machine Identity. +### Access Token Auth + +#### Authenticating +```java +sdk.Auth().SetAccessToken("ACCESS_TOKEN"); +``` + +**Parameters:** +- `accessToken` (string): The access token you want to use for authentication. ### `Secrets` diff --git a/src/main/java/com/infisical/sdk/resources/AuthClient.java b/src/main/java/com/infisical/sdk/resources/AuthClient.java index b3b3662..e955c7e 100644 --- a/src/main/java/com/infisical/sdk/resources/AuthClient.java +++ b/src/main/java/com/infisical/sdk/resources/AuthClient.java @@ -26,4 +26,8 @@ public void UniversalAuthLogin(String clientId, String clientSecret) throws Infi var credential = this.apiClient.post(url, params, MachineIdentityCredential.class); this.onAuthenticate.accept(credential.getAccessToken()); } + + public void SetAccessToken(String accessToken) { + this.onAuthenticate.accept(accessToken); + } } \ No newline at end of file From e4628770cb25c1c2076460d1a422b347a73b8682 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 17 Jan 2025 00:17:13 +0100 Subject: [PATCH 2/2] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38e63e4..c953fb2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,10 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: "17" + java-version: "21" distribution: "temurin" cache: maven