add preauth
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
||||
|
||||
<login-config>
|
||||
<auth-method>FORM</auth-method>
|
||||
<form-login-config>
|
||||
<form-login-page>/login</form-login-page>
|
||||
<form-error-page>/login?error</form-error-page>
|
||||
</form-login-config>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
||||
<role-name>ROLE_USER</role-name>
|
||||
</security-role>
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>Public</web-resource-name>
|
||||
<description>Matches unconstrained pages</description>
|
||||
<url-pattern>/login</url-pattern>
|
||||
<url-pattern>/logout</url-pattern>
|
||||
<url-pattern>/resources/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
</security-constraint>
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>Secured Areas</web-resource-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
<auth-constraint>
|
||||
<role-name>ROLE_USER</role-name>
|
||||
</auth-constraint>
|
||||
</security-constraint>
|
||||
</web-app>
|
||||
@@ -0,0 +1,24 @@
|
||||
<html xmlns:th="https://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Please sign in</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<form name="f" action="/j_security_check" method="post">
|
||||
<fieldset>
|
||||
<legend>Please Login</legend>
|
||||
<div th:if="${param.error}" class="alert alert-error">Invalid
|
||||
username and password.</div>
|
||||
<div th:if="${param.logout}" class="alert alert-success">You
|
||||
have been logged out.</div>
|
||||
<label for="username">Username</label> <input type="text"
|
||||
id="username" name="j_username" /> <label for="password">Password</label>
|
||||
<input type="password" id="password" name="j_password" />
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn">Log in</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user