Hi,
I need help to write my own custom Authenticator.
I wrote my own Authenticator and it's very simple and following is the
code:
public class SampleAuthenticator extends AuthenticatorBase {
public boolean authenticate(Request request,Response
response,LoginConfig config)
throws java.io.IOException{
// if authenticated against LDAP return true
otherwise return false
If(authenticated() == true) {
return true;
} else {
return false;
}
}
}
This Authenticated method is check with LDAP and put Admin in subject.
Is there any thing else I need to do in my custom authenticator?
But when I am executing this request, I am getting error "HTTP Status
403 - Access to the requested resource has been denied".
My web.xml configuration is :
<security-constraint>
<web-resource-collection>
<web-resource-name>Test</web-resource-name>
<description>Test
</description>
<url-pattern>/protected/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>MyAuth</auth-method>
<realm-name>sampleTest</realm-name>
</login-config>
Thanks,
Qaiser Mehmood
Work (512) 248-4269
Cell (571) 438-8639