Basic Authenticator in SEAM

I want to make a basic authentication handler in SEAM. I put this in components.xml

:

    <web:authentication-filter url-pattern="/test/resource/rest/*" auth-type="basic"/>

      

I also added to the web.xml

filter:

<servlet>
    <servlet-name>Rest Servlet</servlet-name>
    <servlet-class>test.BasicAuthenticationServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Rest Servlet</servlet-name>
    <url-pattern>/test/resource/rest/*</url-pattern>
</servlet-mapping>

      

I created a class BasicAuthenticationServlet

like:

public class BasicAuthenticationServlet extends AuthenticationFilter {

public void doFilter(final HttpServletRequest request,
            final HttpServletResponse response, FilterChain chain){
//some code here
}

chain.doFilter(request, response){
//some code here
}

}

      

so I overridden the method doFilter

.

Now I don't understand why it doesn't work? I have NOT found any code for basic auth. in SEAM, all over the web (I mean code that includes a filter and a class, so maybe I missed something in my code?)

+2


source to share


2 answers


Why don't you want to implement it in Seam Mode ?



0


source


I have implemented it with

<web:authentication-filter url-pattern="*.seam" auth-type="basic"/>
<security:identity authenticate-method="#{authenticator.authenticate}"/>

      

not servlets.



And in the authentication method, take the user and go like this:

final String username = identity.getCredentials().getUsername();
  final String password = identity.getCredentials().getPassword();

      

+3


source







All Articles