kaleidos / grails-security-stateless

Grails plugin to implement stateless authentication using Spring Security
Apache License 2.0
17 stars 8 forks source link

Allow developer to put any data on JWT payload #34

Closed ppazos closed 8 years ago

ppazos commented 8 years ago

Right now, JwtStatelessTokenProvider.generateToken only accepts a username. Since some might not use the username to identify users, or might not use a username for authentication at all, it would be good to provide a token generation method that allows other kinds of data in the JWT payload. E.g. in my apps I use a UUID to identify users, not the username.

ref: https://github.com/kaleidos/grails-security-stateless/blob/c86758c70515cdebf23500bac3e39607e7e7eae5/src/groovy/net/kaleidos/grails/plugin/security/stateless/token/JwtStatelessTokenProvider.groovy#L29

ppazos commented 8 years ago

Nevermind, just saw the other param "extraData", but userName seems to be required, is that correct?

pabloalba commented 8 years ago

Correct, userName is required (but it is a simple String, you can pass anything, even the uuid) and on "extraData" you can add any additional data that you need.

ppazos commented 8 years ago

+1