Skip to content

Commit f299b77

Browse files
committed
Update OAuth2 examples
1 parent bb793fb commit f299b77

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

auth/oauth2_token_exchange/jwt_token/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<groupId>tech.ydb.examples.auth</groupId>
77
<artifactId>ydb-sdk-auth-examples</artifactId>
88
<version>1.1.0-SNAPSHOT</version>
9+
<relativePath>../../pom.xml</relativePath>
910
</parent>
1011

1112
<artifactId>ydb-java-example-auth-oauth2-token-credentials</artifactId>

auth/oauth2_token_exchange/jwt_token/src/main/java/tech/ydb/example/Main.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package tech.ydb.example;
22

33

4-
import tech.ydb.auth.OAuth2Token;
54
import tech.ydb.auth.OAuth2TokenExchangeProvider;
5+
import tech.ydb.auth.OAuth2TokenSource;
66
import tech.ydb.core.grpc.GrpcTransport;
77
import tech.ydb.table.SessionRetryContext;
88
import tech.ydb.table.TableClient;
@@ -22,8 +22,8 @@ public static void main(String[] args) {
2222
String oauth2Endpoint = args[1];
2323
String refreshToken = args[2];
2424

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)
2727
.withScope("demo-scope") // customize of OAuth2 request
2828
.build();
2929

auth/oauth2_token_exchange/private_key/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<groupId>tech.ydb.examples.auth</groupId>
77
<artifactId>ydb-sdk-auth-examples</artifactId>
88
<version>1.1.0-SNAPSHOT</version>
9+
<relativePath>../../pom.xml</relativePath>
910
</parent>
1011

1112
<artifactId>ydb-java-example-auth-oauth2-key-credentials</artifactId>

auth/oauth2_token_exchange/private_key/src/main/java/tech/ydb/example/Main.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import java.io.File;
55

6-
import tech.ydb.auth.OAuth2Token;
76
import tech.ydb.auth.OAuth2TokenExchangeProvider;
7+
import tech.ydb.auth.OAuth2TokenSource;
88
import tech.ydb.core.grpc.GrpcTransport;
99
import tech.ydb.table.SessionRetryContext;
1010
import tech.ydb.table.TableClient;
@@ -24,11 +24,11 @@ public static void main(String[] args) {
2424
String oauth2Endpoint = args[1];
2525
String keyPemPath = args[2];
2626

27-
OAuth2Token token = OAuth2Token.fromPrivateKeyPemFile(new File(keyPemPath))
27+
OAuth2TokenSource tokenSource = OAuth2TokenSource.withPrivateKeyPemFile(new File(keyPemPath))
2828
.withIssuer("test-issuer") // customize of JWT token
2929
.build();
3030

31-
OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider.newBuilder(oauth2Endpoint, token)
31+
OAuth2TokenExchangeProvider authProvider = OAuth2TokenExchangeProvider.newBuilder(oauth2Endpoint, tokenSource)
3232
.withScope("demo-scope") // customize of OAuth2 request
3333
.build();
3434

0 commit comments

Comments
 (0)