0

How i convert login-config in web.xml to java class?

I have standart login config in web.xml

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>UserDatabase</realm-name>
    <form-login-config>
      <form-login-page>/login.xhtml</form-login-page>
      <form-error-page>/login.xhtml?error=true</form-error-page>
    </form-login-config>
  </login-config>

and login page which is rendered in xhtml

<form name="login" id="login" action="/c/j_security_check" method="post">

            <table class="auth">
                <tr>
                    <th><label for="username">#{loginMsg.login}</label></th>
                    <td>
                        <input type="text" id="username" name="j_username" />

                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="password" id="password" name="j_password" />
                    </td>
                    <td>
                        <a href="#" onclick="return auth();" class="login">
                            #{loginMsg.enter}
                        </a>
                    </td>
                </tr>
            </table>
            <input type="submit" style="visibility: hidden;" onclick="return checkForm();"/>
        </form>

I need just perform login-config in java class. Help me please

1 Answer 1

0

According to JSR-315 Servlet 3.0 Specification : Ch13.6.3 (pg132),

The only way to configure form-based authentication is by using deployment descriptor (web.xml or web-fragment.xml).

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.