[ 
https://issues.apache.org/jira/browse/CXF-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13505888#comment-13505888
 ] 

Steven Tippetts commented on CXF-4656:
--------------------------------------

Because I'm using the implicit grant type I don't have a grant handler.

I forgot to mention in my last comment that I had to change 
RedirectionBasedGrantService.java to make createUserSubject protected instead 
of private (line 237). I then did an Override on that method that creates a 
UserSubject with the principal, roles, and attributes.  I think this is what 
you were referring to in your comment about making it easier to customize.

After the UserSubject is created in my createUserSubject, it is then passed 
into ImplicitGrantService, which is put into an AccessTokenRegistration, which 
is passed to my OAuthDataProvider's createAccessToken method.  In that method, 
in addition to creating the token, I save the token information to my database, 
including the additional attributes from the UserSubject object. The access 
token is then returned to the client. The client then sends this token to an 
endpoint and requests information.

When the endpoint validates the token with the OAuth server, the getAccessToken 
method on my OAuthDataProvider is called.  I load the token information from my 
database, including the additional UserSubject attributes, and create the 
ServerAccessToken.  This token is then passed to the endpoint.  The endpoint 
can then use the OAuthContext to access the UserSubject attributes.

I hope this makes sense and helps.  Thanks!
                
> [OAuth 2] Add attributes property to UserSubject object
> -------------------------------------------------------
>
>                 Key: CXF-4656
>                 URL: https://issues.apache.org/jira/browse/CXF-4656
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS Security
>    Affects Versions: 2.6.3, 2.7.0
>            Reporter: Steven Tippetts
>
> I need to be able to provide a few authentication attributes to my endpoints 
> along with the login and roles. These attributes are things like the 
> principal's id or name and come from the authentication provider. An 
> "attributes" property that is a Map<String, String> in the UserSubject object 
> would work out nicely.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to