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