Pergunta

I have two apps, server side is based on java with rest easy and client where I'm using angular js.

I used basic authentication where I generated token in first request and all requests used this token, but since I moved project to Wildfly, and there is no Tomcat this way doesn't work.

My class TokenAuthenticator extends BasicAuthenticator from Catalina;

web.xml has:

<login-config>
    <realm-name>App</realm-name>
</login-config>

<security-role>
    <role-name>user</role-name>
</security-role>

and jboss-web.xml:

<jboss-web>
    <security-domain>App</security-domain>
    <valve>
        <class-name>package.TokenAuthenticator</class-name>
    </valve>
    <context-root>/app-server</context-root>
</jboss-web>

In my EJB beans I'm using @RolesAllowed annotation to restrict access to resources.

I read that for now, Wildfly doesn't support valves.

What is my the best alternative?

Foi útil?

Solução

I've changed my mind and implemented form based authentication, but answering on my previous question, I should write a ServletExtension which adds an AuthenticationMechanism to DeploymentInfo. In AuthenticationMechanism, there is a authenticate() method, which authenticate users. You can find a bit info in Undertow documentation.

Probably (before final) they will allow configuration via XML.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top