Skip to content

Instantly share code, notes, and snippets.

@bytestree bytestree/login.jsp
Last active May 6, 2016

What would you like to do?
Custom Login page for Spring Security 4 including CSRF token config
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@ taglib prefix="c" uri=""%>
<title>Spring Security</title>
<form action="login" method="post">
<legend>Please Login</legend>
<c:if test="${param.error != null}">
<p>Authentication Failed : ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}</p>
<c:if test="${param.logout != null}">
<p>You have been logged out successfully.</p>
<label for="username">Username</label>
<input type="text" id="username" name="username" /> <br>
<label for="password">Password</label>
<input type="password" id="password" name="password" /> <br>
<button type="submit">Log in</button>
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />

This comment has been minimized.

Copy link
Owner Author

bytestree commented May 6, 2016

Refer Spring Security 4 with Hibernate for complete example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.