Security JBoss AS:调用方标识没有有效的安全上下文
我需要使用JBoss AS 6在SLSB中获取呼叫者的用户名。因此,我将其传递给InitialContext,如下所示:Security JBoss AS:调用方标识没有有效的安全上下文,security,jboss,ejb,jaas,Security,Jboss,Ejb,Jaas,我需要使用JBoss AS 6在SLSB中获取呼叫者的用户名。因此,我将其传递给InitialContext,如下所示: Context ctx = new InitialContext(); String userName = System.getProperty("user.name"); ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userName); 在我的SLSB中,我尝试使用以下方式访问它: @Resource EJBConte
Context ctx = new InitialContext();
String userName = System.getProperty("user.name");
ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userName);
在我的SLSB中,我尝试使用以下方式访问它:
@Resource
EJBContext ctx;
// ...
String userName = ctx.getCallerPrincipal().getName();
但是,我从JBoss收到以下错误:
java.lang.IllegalStateException: No valid security context for the caller identity
at org.jboss.ejb3.EJBContextImpl.getCallerPrincipal(EJBContextImpl.java:143)
有人能给我一个提示吗?在JAAS世界中,我必须在哪个JBoss AS文件中配置什么才能让它启动并运行?中提供了我问题的答案
<application-policy name="simple">
<authentication>
<login-module code="org.jboss.security.auth.spi.SimpleServerLoginModule" flag="required" />
</authentication>
</application-policy>
小心安全风险使用SimpleServerLoginModule,我的解决方案没有安全性 我的问题的答案在
<application-policy name="simple">
<authentication>
<login-module code="org.jboss.security.auth.spi.SimpleServerLoginModule" flag="required" />
</authentication>
</application-policy>
小心安全风险使用SimpleServerLoginModule,我的解决方案没有安全性