Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 3.69 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. I want two login pages in my spring project
  2. <security:http auto-config="true">
  3.         <security:intercept-url  pattern="/corporaterepresentative/*" access="ROLE_USER" />
  4.  
  5.         <security:form-login login-page="/corporaterepresentativelogin" default-target-url="/corporaterepresentative/representativesignup"
  6.             authentication-failure-url="/corporaterepresentativelogin" />
  7.         <security:logout logout-success-url="/login" />
  8.  
  9.         <security:anonymous enabled="true"/>
  10.  
  11.         <security:intercept-url pattern="/corporateuser/*" access="ROLE_USER" />
  12.  
  13.         <security:form-login   login-page="/corporateuserlogin" default-target-url="/corporateuser/usersignup"
  14.             authentication-failure-url="/corporateuserlogin" />
  15.         <security:logout logout-success-url="/login" />
  16.  
  17. </security:http>
  18.  
  19.  
  20. <security:authentication-manager>
  21.        <security:authentication-provider>
  22.         <security:jdbc-user-service data-source-ref="dataSrc"
  23.            users-by-username-query="select username,password,enabled from spring_users where username=?"
  24.            authorities-by-username-query="select u.username, ur.authority from spring_users u, spring_roles ur where u.user_id=ur.user_id and u.username=?"/>
  25.        </security:authentication-provider>
  26. </security:authentication-manager>
  27.        
  28. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  29.     pageEncoding="ISO-8859-1"%>
  30. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
  31. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  32. <html>
  33. <head>
  34. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  35. <title>Insert title here</title>
  36. </head>
  37. <body>
  38.  
  39. <form name='f' action="<c:url value='j_spring_security_check' />"
  40.     method='POST'>
  41.     <h2>Representative Login</h2>
  42.     <br>
  43.     <table align="center" border="1">
  44.         <tr>
  45.             <td>UserName:</td>
  46.             <td><input type='text' name='j_username' value=''>
  47.             </td>
  48.         </tr>
  49.         <tr>
  50.             <td>Password:</td>
  51.             <td><input type='password' name='j_password' />
  52.             </td>
  53.         </tr>
  54.         <tr>
  55.             <td colspan='2' align="right">
  56.                 <input name="submit" type="submit" value="submit" />
  57.                 <input name="reset" type="reset" />
  58.             </td>
  59.         </tr>
  60.         <tr>
  61.             <td> If Ur a New User <a href="corporaterepresentative/representativesignup"> Click here </a>to Register
  62.  
  63.             </td>
  64.             </tr>
  65.     </table>
  66. </form>
  67. </body>
  68. </html>
  69.        
  70. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  71.     pageEncoding="ISO-8859-1"%>
  72. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
  73. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  74. <html>
  75. <head>
  76. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  77. <title>Insert title here</title>
  78. </head>
  79. <body>
  80.  
  81. <form name='f' action="<c:url value='j_spring_security_check' />"
  82.     method='POST'>
  83.     <h2>User Login</h2>
  84.     <br>
  85.     <table align="center" border="1">
  86.         <tr>
  87.             <td>UserName:</td>
  88.             <td><input type='text' name='j_username' value=''>
  89.             </td>
  90.         </tr>
  91.         <tr>
  92.             <td>Password:</td>
  93.             <td><input type='password' name='j_password' />
  94.             </td>
  95.         </tr>
  96.         <tr>
  97.             <td colspan='2'>
  98.                 <input name="submit" type="submit" value="submit" />
  99.                 <input name="reset" type="reset" />
  100.             </td>
  101.         </tr>
  102.         <tr>
  103.             <td> If Ur a New User <a href="corporateusersignup"> Click here </a>to Register
  104.             </td>
  105.             </tr>
  106.     </table>
  107. </form>
  108. </body>
  109. </html>