Search in sources :

Example 1 with AnonymousPrincipal

use of org.wildfly.security.auth.principal.AnonymousPrincipal in project wildfly by wildfly.

the class ForbidAnonymousInterceptor method processInvocation.

public Object processInvocation(final InterceptorContext context) throws Exception {
    final SecurityDomain securityDomain = context.getPrivateData(SecurityDomain.class);
    Assert.checkNotNullParam("securityDomain", securityDomain);
    if (securityDomain.getCurrentSecurityIdentity().getPrincipal() instanceof AnonymousPrincipal) {
        throw EjbLogger.EJB3_INVOCATION_LOGGER.ejbAuthenticationRequired();
    } else {
        return context.proceed();
    }
}
Also used : AnonymousPrincipal(org.wildfly.security.auth.principal.AnonymousPrincipal) SecurityDomain(org.wildfly.security.auth.server.SecurityDomain)

Aggregations

AnonymousPrincipal (org.wildfly.security.auth.principal.AnonymousPrincipal)1 SecurityDomain (org.wildfly.security.auth.server.SecurityDomain)1