Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extend AuthenticatorBase in Tomcat 7

I am trying to create a custom authenticator in Tomcat 7. So, my understanding is that I need to extend AuthenticatorBase class (similar to FormAuthenticator) and then mention the new authenticator's name in web.xml, something like this:

<login-config>
    <auth-method>CUSTOMAUTH</auth-method>
</login-config>

Create a Jar out of the Custom Authenticator class and put it in tomcatDir\lib\

Now where do I mention the mapping between "CUSTOMAUTH" and my class CustomAuthenticator.java which might be in , lets say, com.authentication.custom.CustomAuthenticator.java ?

Could you please let me know the path to the config file for both windows (my dev environment) as well as Linux (our actual servers).

Please correct me if I am wrong about any of the steps above.

Thanks in advance for your time!

like image 514
user1797559 Avatar asked Nov 19 '25 19:11

user1797559


1 Answers

You will need to override the method

protected abstract String getAuthMethod();

Here you must return CUSTOMAUTH

like image 196
danidacila Avatar answered Nov 22 '25 07:11

danidacila



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!