Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0"?>
- <web-app xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" id="WebApp_ID">
- <display-name>Spring MVC</display-name>
- <welcome-file-list>
- <welcome-file>/WEB-INF/pages/hello.jsp</welcome-file>
- </welcome-file-list>
- <servlet>
- <servlet-name>mvc-dispatcher</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>mvc-dispatcher</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- /WEB-INF/mvc-dispatcher-servlet.xml,
- /WEB-INF/spring-security.xml
- </param-value>
- </context-param>
- <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>
- </filter-mapping>
- </web-app>
- <beans:beans xmlns="http://www.springframework.org/schema/security"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/security
- http://www.springframework.org/schema/security/spring-security-3.2.xsd">
- <http auto-config="true">
- <intercept-url pattern="/welcome*" access="ROLE_USER" />
- <http-basic />
- </http>
- <authentication-manager>
- <authentication-provider>
- <user-service>
- <user name="rahul" password="123" authorities="ROLE_USER" />
- </user-service>
- </authentication-provider>
- </authentication-manager>
- </beans:beans>
- <?xml version="1.0"?>
- <beans xsi:schemaLocation=" http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns="http://www.springframework.org/schema/beans">
- <context:component-scan base-package="test"/>
- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix">
- <value>/WEB-INF/pages/</value>
- </property>
- <property name="suffix">
- <value>.jsp</value>
- </property>
- </bean>
- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
- <property name="basenames">
- <list>
- <value>mymessages</value>
- </list>
- </property>
- </bean>
- </beans>
- <%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
- <html>
- <head>
- <title>Login Page</title>
- <style>
- .errorblock {
- color: #ff0000;
- background-color: #ffEEEE;
- border: 3px solid #ff0000;
- padding: 8px;
- margin: 16px;
- }
- </style>
- </head>
- <body onload='document.f.j_username.focus();'>
- <h3>Login with Username and Password (Custom Page)</h3>
- <c:if test="${SPRING_SECURITY_LAST_EXCEPTION !=null}"><!-- ${not empty error} -->
- <div class="errorblock">
- Your login attempt was not successful, try again.<br /> Caused :
- ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
- </div>
- </c:if>
- <form name='f' action="<c:url value='j_spring_security_check' />"
- method='POST'>
- <table>
- <tr>
- <td>User:</td>
- <td><input type='text' name='j_username' value=''>
- </td>
- </tr>
- <tr>
- <td>Password:</td>
- <td><input type='password' name='j_password' />
- </td>
- </tr>
- <tr>
- <td colspan='2'><input name="submit" type="submit"
- value="submit" />
- </td>
- </tr>
- <tr>
- <td colspan='2'><input name="reset" type="reset" />
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld" %>
- <html>
- <body>
- <h3>message : ${message}</h3>
- <h3>User name : ${username}</h3>
- <a href = "<c:url value="/j_spring_security_logout" />">LogOut</a>
- </body>
- </html>
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <h3>Welcome to spring security</h3>
- <a href="/SpringSecurity1-FORM/welcome"><b>Click here to logon</b></a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement