You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Log a warning when AuthorizationGrantType does not exactly match a pre-defined constantΒ #11905
When building a ClientRegistration and passing a string to the AuthorizationGrantType constructor, invalid grant types that match case insensitively with a pre-defined constant could log a warning informing users that it won't match a valid OAuth2AuthorizedClientProvider.
Current Behavior
The AuthorizationGrantType constructor accepts any string (including a capitalized grant type string, e.g. CLIENT_CREDENTIALS), assuming it is a custom grant type. This allows an application to start up and load a ClientRegistration without warnings, but does not work as expected because no OAuth2AuthorizedClientProvider is matched.
Would the warning show if there are any capitals in the value, or would it only show if a value you input is similar to one of the spring-provided defaults?
I think it would make sense to log a warning if it does not strictly equal, but does equal case-insensitively (e.g. equalsIgnoreCase()).
And would this warning be inside the constructor?
I think it would go in ClientRegistration.Builder.build().
@msosa while this is for initialization only, we generally avoid the use of streams for internal framework usage. But otherwise, this would be a good start, yes!
Activity
sjohnr commentedon Sep 27, 2022
@msosa (see comment):
I think it would make sense to log a warning if it does not strictly equal, but does equal case-insensitively (e.g.
equalsIgnoreCase()).I think it would go in
ClientRegistration.Builder.build().msosa commentedon Sep 27, 2022
@sjohnr I came up with this approach inside
ClientRegistration.Builder, let me know if the implementation is ok or if you have any suggestions.will make a PR to follow if this is an ok approach
sjohnr commentedon Sep 28, 2022
@msosa while this is for initialization only, we generally avoid the use of streams for internal framework usage. But otherwise, this would be a good start, yes!
Warn when AuthorizationGrantType does not match