NIFI-14469 - Support custom fields in AccessToken#9872
NIFI-14469 - Support custom fields in AccessToken#9872exceptionfactory merged 5 commits intoapache:mainfrom
Conversation
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks @pvillard31, the concept sounds good, but it looks like the implementation approach should be adjusted. I can provide more details on options if needed, but it should be possible to configure the Jackson implementation to handle the custom fields, without necessarily annotating the AccessToken class itself.
nifi-extension-bundles/nifi-standard-services/nifi-oauth2-provider-api/pom.xml
Outdated
Show resolved
Hide resolved
|
Thanks for the review @exceptionfactory - I just pushed a commit where I'm instead using a custom deserializer to not add a Jackson dependency on the API. The only downside I see with this approach is that the deserializer would be needed in all bundles where an implementation requires this feature. But I guess it's ok as we should not see so many implementations. |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @pvillard31.
Have you evaluated using the JsonView annotation on a subclass of AccessToken within the StandardOauth2AccessTokenProvider? Having an internal subclass of AccessToken, with an interface method annotated with JsonAnySetter seems like an approach that would work without having to implement a full Deserializer.
|
Thanks @exceptionfactory - I was not aware of the JsonView annotation. I just pushed a commit to leverage it. Let me know if this is what you had in mind. |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @pvillard31, this looks close to what I had in mind. I noted a couple adjustments to keep the mapping view internal to the implementation module, otherwise, this looks close to completion.
...dard-services/nifi-oauth2-provider-api/src/main/java/org/apache/nifi/oauth2/AccessToken.java
Outdated
Show resolved
Hide resolved
...services/nifi-oauth2-provider-api/src/main/java/org/apache/nifi/oauth2/AccessTokenViews.java
Outdated
Show resolved
Hide resolved
...services/nifi-oauth2-provider-api/src/main/java/org/apache/nifi/oauth2/AccessTokenViews.java
Outdated
Show resolved
Hide resolved
|
Addressed your comments - this concept of JsonView is new to me, appreciate the guidance! |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @pvillard31, after taking another look at available options, the mix-in strategy appears to be the most concise solution, enabling a simple interface with matching method signature to apply the JsonAnySetter annotation.
I pushed that change and also renamed the Map to additionalParameters, which follows the convention of Spring Security's OAuth2AccessTokenReponse class. I also changed the Map value type from String to Object, since it could be something else, such as a number.
If these changes look good, I circle back to complete the review.
|
Changes LGTM, thanks @exceptionfactory |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the concurrence @pvillard31! +1 merging
…ken (apache#9872) Co-authored-by: David Handermann <exceptionfactory@apache.org> Signed-off-by: David Handermann <exceptionfactory@apache.org>
Summary
NIFI-14469 - Support custom fields in AccessToken
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation