doc: Custom binding of authenticated user#1524
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
There was a problem hiding this comment.
While I think showing this particular example is useful in its own right, I don't really think it addresses the specific use case from #1430 wherein they are fully replacing the default Authentication object such that a call to request.getUserPrincipal(AuthenticationWithEmail.class) would be expected to work.
To address that case, I think we'd want to also show that it's possible to just extend AbstractPrincipalArgumentBinder as they did, but explain how that approach only works with something like a custom AuthenticationProvider.
Also as an aside that should probably be addressed separately, I notice that providing a custom implementation of TokenValidator as you have in the tests here seems like a nice simple way to enhance the Authentication attributes, but I don't see it mentioned anywhere in the documentation.
They are not fully replacing authentication. They are creating: class TokenAuthentication implements Authentication {
String token
}I think this PR adds the docs they would need for they usecase (bind such a class in a controller method parameter). Happy to do further improvements but I think we should get this merged in. |
In #1430 (comment) they said that simply extending i.e., in Java their example would be: The |
jeremyg484
left a comment
There was a problem hiding this comment.
See my prior comment above. I think this is good in its own right to be merged, but I don't think it addresses the specific case in #1430, so I don't think it should close that issue.
We should address that separately, either with my suggested enhancement in #1522, or by providing a separate documentation example of extending AbstractPrincipalArgumentBinder, or both.








Close: #1430