-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth Manager API part 4: RESTClient, HTTPClient #11992
base: main
Are you sure you want to change the base?
Conversation
any()); | ||
} | ||
|
||
@Test | ||
public void testCatalogCredentialNoOauth2ServerUri() { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we might want to consider keeping this so that it's clearer that empty headers are expected
any()); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"}) | ||
public void testCatalogCredential(String oauth2ServerUri) { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
any()); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"}) | ||
public void testCatalogCredentialWithClientCredential(String oauth2ServerUri) { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
any()); | ||
} | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"}) | ||
public void testCatalogTokenRefresh(String oauth2ServerUri) { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
any()); | ||
}); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"}) | ||
public void testCatalogRefreshedTokenIsUsed(String oauth2ServerUri) { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -1653,7 +1517,6 @@ public void testCatalogExpiredBearerTokenIsRefreshedWithCredential(String oauth2 | |||
// expires at epoch second = 1 | |||
String token = | |||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjF9.gQADTbdEv-rpDWKSkGLbmafyB5UUjTdm9B_1izpuZ6E"; | |||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
any()); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"}) | ||
public void testCatalogTokenRefreshFailsAndUsesCredentialForRefresh(String oauth2ServerUri) { | ||
Map<String, String> emptyHeaders = ImmutableMap.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
eq(OAuthTokenResponse.class), | ||
eq(ImmutableMap.of()), | ||
anyMap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this rather verify that this should be an empty map instead of any map?
4th PR for the Auth Manager API. Previous ones:
This PR introduces the required changes to
RESTClient
andHTTPClient
. It also introduces aBaseHTTPClient
abstract class to facilitate the creation and execution ofHTTPRequest
s in a consistent way.The biggest change in actually in
TestRESTCatalog
, because almost everyMockito.verify()
call needs to be adapted.The AuthManager API is still "unplugged" at this point.
\cc @nastra @danielcweeks