Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Context ctx = new InitialContext();
- String userName = System.getProperty("user.name");
- ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userName);
- @Resource
- EJBContext ctx;
- // ...
- String userName = ctx.getCallerPrincipal().getName();
- java.lang.IllegalStateException: No valid security context for the caller identity
- at org.jboss.ejb3.EJBContextImpl.getCallerPrincipal(EJBContextImpl.java:143)
- <application-policy name="simple">
- <authentication>
- <login-module code="org.jboss.security.auth.spi.SimpleServerLoginModule" flag="required" />
- </authentication>
- </application-policy>
Add Comment
Please, Sign In to add comment