Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.databricks.sdk.core.oauth;

/**
* Represents an ID Token provided by an identity provider from an OAuth flow. This token can later
* be exchanged for an access token.
*/
public class IDToken {
// The string value of the ID Token
private final String value;

/**
* Constructs an IDToken with a value.
*
* @param value The ID Token string.
*/
public IDToken(String value) {
this.value = value;
}
Comment thread
emmyzhou-db marked this conversation as resolved.

public String getValue() {
Comment thread
emmyzhou-db marked this conversation as resolved.
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.databricks.sdk.core.oauth;

/** IDTokenSource is anything that returns an IDToken given an audience. */
public interface IDTokenSource {
/**
* Retrieves an ID Token for the specified audience.
*
* @param audience The intended recipient of the ID Token.
* @return An {@link IDToken} containing the token value.
*/
IDToken getIDToken(String audience);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.databricks.sdk.core.oauth;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

public class IDTokenTest {

private static final String accessToken = "testIdToken";

@Test
void createIDToken() {
IDToken idToken = new IDToken(accessToken);
assertEquals(accessToken, idToken.getValue());
}
Comment thread
emmyzhou-db marked this conversation as resolved.
}
Loading