Created
August 8, 2014 18:44
-
-
Save dilnei/dbcb69e64c6bf5a42b9c to your computer and use it in GitHub Desktop.
Responsável por pegar o usuário do JAAS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package br.com.app.model.entity.listener; | |
| import javax.annotation.Resource; | |
| import javax.annotation.security.PermitAll; | |
| import javax.ejb.LocalBean; | |
| import javax.ejb.SessionContext; | |
| import javax.ejb.Stateless; | |
| /** | |
| * Responsável por pegar o usuário do JAAS. | |
| * | |
| * @author Dilnei Cunha | |
| */ | |
| @Stateless | |
| @LocalBean | |
| @PermitAll | |
| public class CurrentUserBean { | |
| @Resource | |
| private SessionContext context; | |
| public String getCurrentUser() { | |
| return context.getCallerPrincipal().getName(); | |
| } | |
| public SessionContext setCurrentUser(SessionContext context) { | |
| return context; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment