13

Where is the default login page generated in Spring Security 4 when you use the simplest of configurations?

<http>
...
    <form-login/>
</http>

I am using this basic sample web application for Spring Security.

Is almost the same as this question Where is the default login page for the spring security core plugin? but for Java.

Community
  • 1
  • 1
lmiguelmh
  • 3,074
  • 1
  • 37
  • 53

2 Answers2

23

It is generated from this class org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter :

private String generateLoginPageHtml(HttpServletRequest request, boolean loginError, boolean logoutSuccess) {
    String errorMsg = "none";

    [...]

    StringBuilder sb = new StringBuilder();

    sb.append("<html><head><title>Login Page</title></head>");

    if (formLoginEnabled) {
        sb.append("<body onload='document.f.").append(usernameParameter).append(".focus();'>\n");
    }

    [...]
Arnaud Denoyelle
  • 29,980
  • 16
  • 92
  • 148
4

DefaultLoginPageGeneratingFilter will be used to generate default forms in the case where a user doesn't configure a login page. It has a private generateLoginPageHtml responsible for generating the default html view.

Ali Dehghani
  • 46,221
  • 15
  • 164
  • 151