-
Notifications
You must be signed in to change notification settings - Fork 6.1k
ClientRegistration contains Provider Configuration Metadata #5729
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
Conversation
@@ -42,6 +44,13 @@ | |||
private static final String TOKEN_URI = "https://provider.com/oauth2/token"; | |||
private static final String JWK_SET_URI = "https://provider.com/oauth2/keys"; | |||
private static final String CLIENT_NAME = "Client 1"; | |||
private static final Map<String, Object> PROVIDER_CONFIGURATION_METADATA = new LinkedHashMap<>(); | |||
|
|||
static { |
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.
Please extract initialization into a method.
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.
This isn't truly final because Map is mutable. Please change the Map to be immutable or (preferably) remove the static modifier.
@rwinch I applied the polish to the test. |
@@ -153,6 +155,7 @@ public String toString() { | |||
private String tokenUri; | |||
private UserInfoEndpoint userInfoEndpoint = new UserInfoEndpoint(); | |||
private String jwkSetUri; | |||
private Map<String, Object> configurationMetadata; |
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.
I think it would be good to make this by default empty so user's don't need to worry about NPE
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.
NPE would never happen with configurationMetadata
- see where it gets init
@@ -262,6 +275,7 @@ public static Builder withRegistrationId(String registrationId) { | |||
private AuthenticationMethod userInfoAuthenticationMethod = AuthenticationMethod.HEADER; | |||
private String userNameAttributeName; | |||
private String jwkSetUri; | |||
private Map<String, Object> configurationMetadata; |
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.
I think it would be good to make this by default empty so user's don't need to worry about NPE
* @return the {@link Builder} | ||
*/ | ||
public Builder providerConfigurationMetadata(Map<String, Object> configurationMetadata) { | ||
this.configurationMetadata = configurationMetadata; |
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.
In combination with making configurationMetadata
empty, we should also prevent this from be null
@rwinch I applied the requested updates to |
* @return the {@link Builder} | ||
*/ | ||
public Builder providerConfigurationMetadata(Map<String, Object> configurationMetadata) { | ||
if (!CollectionUtils.isEmpty(configurationMetadata)) { |
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.
This is not actually setting the value (as the Javadoc states) if it is empty. We should avoid setting the value to null, but we should not avoid setting it to an empty collection if the input is empty.
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.
I applied the update @rwinch
@@ -453,7 +453,7 @@ public Builder jwkSetUri(String jwkSetUri) { | |||
* @return the {@link Builder} | |||
*/ | |||
public Builder providerConfigurationMetadata(Map<String, Object> configurationMetadata) { | |||
if (!CollectionUtils.isEmpty(configurationMetadata)) { | |||
if (configurationMetadata != null) { |
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.
Can we add a test since this was a problem?
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.
@rwinch I added a couple of tests
@jgrandja The changes look good. Once the Travis build passes, please go ahead and squash and merge. |
Merged via 057587e |
Fixes gh-5540