0
votes

Hi I am new to spring security and I am trying to implement multiple authentication manager for multiple Login Page. But I am stuck as I am not able to create a customized login page.This is my Security.xml

<http auto-config='true' use-expressions="true" authentication-manager-ref="customAuthenticationManager1" >

<intercept-url pattern="/**" access="isAuthenticated()" />
<form-login
login-page='/Admin_Login.jsp'
login-processing-url="/j_spring_security_check.action"
default-target-url="/home.jsp"
always-use-default-target="true"/>
<logout logout-success-url="/login.html" />

<logout />
</http>

My Login page is as follows :-

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ADMIN LOGIN</title>
</head>
<body>
<form action="/j_spring_security_check" method="POST">
<label for="username">User Name:</label>
<input id="username" name="j_username" type="text"/>
<label for="password">Password:</label>
<input id="password" name="j_password" type="password"/>
<input type="submit" value="Log In"/>
</form>
</body>
</html>

But when I try to login it is not goin into Authentication manager . Its giving

HTTP Status 404 - /j_spring_security_check error. So can some one tell where I am going wrong.

2

2 Answers

0
votes

Have you set the spring security filter in web.xml?

<filter>
  <filter-name>springSecurityFilterChain</filter-name>
  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
  <filter-name>springSecurityFilterChain</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>
</filter-mapping>
0
votes

There are two options

Option 1:

Remove login-processing-url attribute from <form-login> tag as the default URL is /j_spring_security_check.

Option 2:

Change login-processing-url="/j_spring_security_check.action" to login-processing-url="/j_spring_security_check"