JAX-WS endpoint as Stateless EJB with SecurityContext returning wrong user (Anonymous) in JBoss EAP 7

Solution In Progress - Updated -

Issue

In a JAX-WS endpoint as Stateless EJB, the securityContext.getCallerPrincipal().getName() is always returning Anonymous name, even when an user is informed.

@Stateless
@WebService()
public class HelloWorldImpl implements HelloWorld {

    @Resource
    private SessionContext securityContext;

    @Override
    public String hello() {
        return "User:"+securityContext.getCallerPrincipal().getName();
    }
}

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In