{"action":"created","issue":{"url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/12","repository_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas","labels_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/12/comments","events_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/12/events","html_url":"https://github.com/grails-plugins/grails-spring-security-cas/issues/12","id":166535579,"number":12,"title":"Get logged user attributes","user":{"login":"flparedes","id":13085943,"avatar_url":"https://avatars3.githubusercontent.com/u/13085943?v=4","gravatar_id":"","url":"https://api.github.com/users/flparedes","html_url":"https://github.com/flparedes","followers_url":"https://api.github.com/users/flparedes/followers","following_url":"https://api.github.com/users/flparedes/following{/other_user}","gists_url":"https://api.github.com/users/flparedes/gists{/gist_id}","starred_url":"https://api.github.com/users/flparedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flparedes/subscriptions","organizations_url":"https://api.github.com/users/flparedes/orgs","repos_url":"https://api.github.com/users/flparedes/repos","events_url":"https://api.github.com/users/flparedes/events{/privacy}","received_events_url":"https://api.github.com/users/flparedes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-20T09:16:21Z","updated_at":"2017-10-09T07:16:22Z","closed_at":"2017-10-09T07:16:22Z","author_association":"NONE","body":"Dear all,\n\nI'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 \"_cas_stateful_\" and I can't use this username to find the real user data.\n\nMy question is, how can I get the logged user attributes, so I can use the correct attribute to load de user.\n\nThanks in advance.\n"},"comment":{"url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/comments/335080783","html_url":"https://github.com/grails-plugins/grails-spring-security-cas/issues/12#issuecomment-335080783","issue_url":"https://api.github.com/repos/grails-plugins/grails-spring-security-cas/issues/12","id":335080783,"user":{"login":"sdelamo","id":864788,"avatar_url":"https://avatars1.githubusercontent.com/u/864788?v=4","gravatar_id":"","url":"https://api.github.com/users/sdelamo","html_url":"https://github.com/sdelamo","followers_url":"https://api.github.com/users/sdelamo/followers","following_url":"https://api.github.com/users/sdelamo/following{/other_user}","gists_url":"https://api.github.com/users/sdelamo/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelamo/subscriptions","organizations_url":"https://api.github.com/users/sdelamo/orgs","repos_url":"https://api.github.com/users/sdelamo/repos","events_url":"https://api.github.com/users/sdelamo/events{/privacy}","received_events_url":"https://api.github.com/users/sdelamo/received_events","type":"User","site_admin":false},"created_at":"2017-10-09T07:16:21Z","updated_at":"2017-10-09T07:16:21Z","author_association":"CONTRIBUTOR","body":"@flparedes \r\n\r\nYou 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. \r\n\r\n```\r\nclass SecureController {\r\n\r\nSpringSecurityService springSecurityService\r\n\r\n\t@Secured('ROLE_ADMIN')\r\n\tdef admins() {\r\n\t\tlog.info \"Logged Username: {}\", springSecurityService.principal.username\r\n```\r\n\r\nI hope this solves the issue. Please, reopen if the issue is still open. "}}
{"actor":{"display_login":"sdelamo"}}