You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-25Lines changed: 28 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,12 @@ This repository contains the STACKIT SDKs for Java.
16
16
17
17
Requires Java 8 or higher.
18
18
19
-
The release artifacts of the STACKIT Java SDK are available on [Maven Central](https://central.sonatype.com/namespace/cloud.stackit.sdk).
19
+
The release artifacts of the STACKIT Java SDK are available on [Maven Central](https://central.sonatype.com/namespace/cloud.stackit.sdk).
20
20
See below how to use them in your Java project.
21
21
22
22
### Maven
23
23
24
-
Add the dependencies for the services you want to interact with to your project's POM, e.g. `iaas` and `resourcemanager` (replace `<SDK_VERSION>` with the latest version of each SDK submdoule):
24
+
Add the dependencies for the services you want to interact with to your project's POM, e.g. `iaas` and `resourcemanager` (replace `<SDK_VERSION>` with the latest version of each SDK submdoule):
25
25
26
26
```xml
27
27
<dependency>
@@ -97,31 +97,33 @@ This will make it much easier to configure the key flow authentication in the SD
97
97
To configure the key flow, follow this steps:
98
98
99
99
1. Create a service account key:
100
-
- Use the STACKIT Portal: go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/stackit/en/create-a-service-account-key-175112456.html).
100
+
- Use the STACKIT Portal: go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key. For more details, see [Create a service account key](https://docs.stackit.cloud/stackit/en/create-a-service-account-key-175112456.html).
101
101
2. Save the content of the service account key by copying it and saving it in a JSON file. The expected format of the service account key is **JSON** with the following structure:
"privateKey": "(OPTIONAL) private key when generated by the SA service"
119
+
}
120
+
}
121
+
```
122
122
123
123
3. Configure the service account key for authentication in the SDK by following one of the alternatives below:
124
+
124
125
- using the configuration options:
126
+
125
127
```java
126
128
CoreConfiguration config =
127
129
newCoreConfiguration()
@@ -130,6 +132,7 @@ To configure the key flow, follow this steps:
130
132
131
133
ResourceManagerApi api =newResourceManagerApi(config);
132
134
```
135
+
133
136
- setting the environment variable: `STACKIT_SERVICE_ACCOUNT_KEY_PATH`
134
137
- setting `STACKIT_SERVICE_ACCOUNT_KEY_PATH` in the credentials file (see above)
135
138
@@ -145,11 +148,11 @@ To configure the key flow, follow this steps:
145
148
>- setting the environment variable: `STACKIT_PRIVATE_KEY_PATH`
146
149
>- setting `STACKIT_PRIVATE_KEY_PATH` in the credentials file (see above)
147
150
148
-
> **Alternatively, if you can't store the credentials in a file, e.g. when using it in a pipeline**, you can store the credentials in environment variables:
151
+
>**Alternatively, if you can't store the credentials in a file, e.g. when using it in a pipeline**, you can store the credentials in environment variables:
152
+
>
149
153
> - setting the environment variable `STACKIT_SERVICE_ACCOUNT_KEY` with the content of the service account key
150
154
> - (OPTIONAL) setting the environment variable `STACKIT_PRIVATE_KEY` with the content of the private key
151
155
152
-
153
156
4. The SDK will search for the keys and, if valid, will use them to get access and refresh tokens which will be used to authenticate all the requests.
154
157
155
158
Check the [authentication example](examples/authentication/src/main/java/cloud/stackit/sdk/authentication/examples/AuthenticationExample.java) for more details.
Copy file name to clipboardExpand all lines: examples/authentication/src/main/java/cloud/stackit/sdk/authentication/examples/AuthenticationExample.java
0 commit comments