Closed flparedes closed 7 years ago
Is the user you are logging in as in the local database 'user' table?
Hello Neal,
I was using a CAS test server hosted in heroku, but because the problems with the logged users I've dowloaded a minimal CAS server and run it locally.
With this local CAS server I have no problem logging user, but I still don't know how to get the attributes. For example I've got another application made with Spark Java and after the CAS loggin I can get all the user attributes using a UserProfile object stored in the application context.
Does the grails-spring-security-cas have something similar to get the logged user attributes?
@flparedes is that getting user attributes what you are looking for ?
@flparedes
You could use springSecurityService.principal.username
to get the logged username. For example if logged in the CAS server with admin
, then springSecurityService.principal.username
will be: admin
. Or springSecurityService.principal.authorities
to get user's roles.
class SecureController {
SpringSecurityService springSecurityService
@Secured('ROLE_ADMIN')
def admins() {
log.info "Logged Username: {}", springSecurityService.principal.username
I hope this solves the issue. Please, reopen if the issue is still open.
Dear all,
I'm developing a web app using Grails 3.1.9 and spring-security-cas 3.0.0. The problem is that when I try to login the username returned is "_casstateful" and I can't use this username to find the real user data.
My question is, how can I get the logged user attributes, so I can use the correct attribute to load de user.
Thanks in advance.