mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 17:27:40 +00:00
Remove other docs, focus on the identity id use case
This commit is contained in:
@@ -107,44 +107,6 @@ sdk.Auth().UniversalAuthLogin(
|
|||||||
|
|
||||||
### AWS Auth
|
### AWS Auth
|
||||||
|
|
||||||
```java
|
|
||||||
public void AwsAuthLogin(
|
|
||||||
AwsAuthLoginInput input
|
|
||||||
)
|
|
||||||
throws InfisicalException
|
|
||||||
```
|
|
||||||
|
|
||||||
```java
|
|
||||||
var input = AwsAuthLoginInput
|
|
||||||
.builder()
|
|
||||||
.identityId("<machine-identity-id>")
|
|
||||||
.iamHttpRequestMethod("<iam-http-request-method>")
|
|
||||||
.iamRequestHeaders("<iam-request-headers>")
|
|
||||||
.iamRequestBody("<iam-request-body>")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
sdk.Auth().AwsAuthLogin(input);
|
|
||||||
```
|
|
||||||
|
|
||||||
**Parameters:**
|
|
||||||
- `input` (AwsAuthLoginInput): The input for authenticating with AWS.
|
|
||||||
- `identityId` (String): The ID of the machine identity to authenticate with.
|
|
||||||
- `iamHttpRequestMethod` (String): The HTTP request method used in the signed request.
|
|
||||||
- `iamRequestHeaders` (String): The base64-encoded headers of the sts:GetCallerIdentity signed request.
|
|
||||||
- `iamRequestBody` (String): The base64-encoded body of the signed request. Most likely, the base64-encoding of Action=GetCallerIdentity&Version=2011-06-15.
|
|
||||||
|
|
||||||
Generating the login input requires retrieving AWS credentials from the current local environment and performing an AWS Signature Version 4 on the retrieved data.
|
|
||||||
To make it much easier for users, we provide a helper class to automatically generate the login input for you.
|
|
||||||
|
|
||||||
```java
|
|
||||||
import com.infisical.sdk.auth.AwsAuthProvider;
|
|
||||||
var input = AwsAuthProvider.defaultProvider()
|
|
||||||
.fromInstanceProfile()
|
|
||||||
.toLoginInput("<machine-identity-id>");
|
|
||||||
```
|
|
||||||
|
|
||||||
Since this is the most common use case for AWS authentication, we also provide an overloaded method for `AwsAuthLogin`:
|
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public void AwsAuthLogin(
|
public void AwsAuthLogin(
|
||||||
String identityId
|
String identityId
|
||||||
@@ -152,25 +114,12 @@ public void AwsAuthLogin(
|
|||||||
throws InfisicalException
|
throws InfisicalException
|
||||||
```
|
```
|
||||||
|
|
||||||
With this method, you can pass in the `identityId`, and it will retrieve AWS credentials automatically for you from your current environment:
|
|
||||||
|
|
||||||
```java
|
```java
|
||||||
sdk.Auth().AwsAuthLogin("<machine-identity-id>");
|
sdk.Auth().AwsAuthLogin("<machine-identity-id>");
|
||||||
```
|
```
|
||||||
|
|
||||||
If you prefer to retrieve AWS credentials manually from your local AWS environment, you can generate the login input by providing the AWS credentials yourself, as shown below:
|
**Parameters:**
|
||||||
|
- `identityId` (String): The ID of the machine identity to authenticate with.
|
||||||
```java
|
|
||||||
import com.infisical.sdk.auth.AwsAuthProvider;
|
|
||||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
|
||||||
var input = AwsAuthProvider.defaultProvider()
|
|
||||||
.fromCredentials(
|
|
||||||
"<aws-region>",
|
|
||||||
AwsBasicCredentials.create("<aws-access-key>", "<aws-secret-key>"),
|
|
||||||
"<aws-session-token>"
|
|
||||||
)
|
|
||||||
.toLoginInput("<machine-identity-id>");
|
|
||||||
```
|
|
||||||
|
|
||||||
### LDAP Auth
|
### LDAP Auth
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user