File tree 4 files changed +8
-6
lines changed
auth/oauth2_token_exchange
src/main/java/tech/ydb/example
src/main/java/tech/ydb/example 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 6
6
<groupId >tech.ydb.examples.auth</groupId >
7
7
<artifactId >ydb-sdk-auth-examples</artifactId >
8
8
<version >1.1.0-SNAPSHOT</version >
9
+ <relativePath >../../pom.xml</relativePath >
9
10
</parent >
10
11
11
12
<artifactId >ydb-java-example-auth-oauth2-token-credentials</artifactId >
Original file line number Diff line number Diff line change 1
1
package tech .ydb .example ;
2
2
3
3
4
- import tech .ydb .auth .OAuth2Token ;
5
4
import tech .ydb .auth .OAuth2TokenExchangeProvider ;
5
+ import tech .ydb .auth .OAuth2TokenSource ;
6
6
import tech .ydb .core .grpc .GrpcTransport ;
7
7
import tech .ydb .table .SessionRetryContext ;
8
8
import tech .ydb .table .TableClient ;
@@ -22,8 +22,8 @@ public static void main(String[] args) {
22
22
String oauth2Endpoint = args [1 ];
23
23
String refreshToken = args [2 ];
24
24
25
- OAuth2Token token = OAuth2Token .fromValue (refreshToken );
26
- OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider .newBuilder (oauth2Endpoint , token )
25
+ OAuth2TokenSource tokenSource = OAuth2TokenSource .fromValue (refreshToken );
26
+ OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider .newBuilder (oauth2Endpoint , tokenSource )
27
27
.withScope ("demo-scope" ) // customize of OAuth2 request
28
28
.build ();
29
29
Original file line number Diff line number Diff line change 6
6
<groupId >tech.ydb.examples.auth</groupId >
7
7
<artifactId >ydb-sdk-auth-examples</artifactId >
8
8
<version >1.1.0-SNAPSHOT</version >
9
+ <relativePath >../../pom.xml</relativePath >
9
10
</parent >
10
11
11
12
<artifactId >ydb-java-example-auth-oauth2-key-credentials</artifactId >
Original file line number Diff line number Diff line change 3
3
4
4
import java .io .File ;
5
5
6
- import tech .ydb .auth .OAuth2Token ;
7
6
import tech .ydb .auth .OAuth2TokenExchangeProvider ;
7
+ import tech .ydb .auth .OAuth2TokenSource ;
8
8
import tech .ydb .core .grpc .GrpcTransport ;
9
9
import tech .ydb .table .SessionRetryContext ;
10
10
import tech .ydb .table .TableClient ;
@@ -24,11 +24,11 @@ public static void main(String[] args) {
24
24
String oauth2Endpoint = args [1 ];
25
25
String keyPemPath = args [2 ];
26
26
27
- OAuth2Token token = OAuth2Token . fromPrivateKeyPemFile (new File (keyPemPath ))
27
+ OAuth2TokenSource tokenSource = OAuth2TokenSource . withPrivateKeyPemFile (new File (keyPemPath ))
28
28
.withIssuer ("test-issuer" ) // customize of JWT token
29
29
.build ();
30
30
31
- OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider .newBuilder (oauth2Endpoint , token )
31
+ OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider .newBuilder (oauth2Endpoint , tokenSource )
32
32
.withScope ("demo-scope" ) // customize of OAuth2 request
33
33
.build ();
34
34
You can’t perform that action at this time.
0 commit comments