This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Spring MVC --> | |
<servlet> | |
<servlet-name>spring-mvc</servlet-name> | |
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | |
<init-param> | |
<param-name>contextConfigLocation</param-name> | |
<param-value>classpath:spring-mvc-servlet.xml</param-value> | |
</init-param> | |
<load-on-startup>1</load-on-startup> | |
</servlet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:context="http://www.springframework.org/schema/context" | |
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-4.2.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd"> | |
<context:annotation-config /> | |
<context:component-scan base-package="com.bytestree.*" /> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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-4.2.xsd | |
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd"> | |
<http auto-config="true"> | |
<intercept-url pattern="/login" access="permitAll" /> | |
<intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" /> | |
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component("customAuthenticationFailureHandler") | |
public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { | |
private String DEFAULT_FAILURE_URL = "/login?error"; | |
@Autowired | |
private UserService userService; | |
@Override | |
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.model; | |
import java.io.Serializable; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.FetchType; | |
import javax.persistence.Id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" | |
pageEncoding="ISO-8859-1"%> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
<html> | |
<head> | |
<title>Spring Security</title> | |
</head> | |
<body> | |
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> | |
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
<%@page session="false"%> | |
<html> | |
<body> | |
<h1>Home Page</h1> | |
<h2>${message}</h2> | |
<a href='<c:url value="/admin" />'>Admin Page</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytestree.dao; | |
import java.io.Serializable; | |
import java.lang.reflect.ParameterizedType; | |
import org.hibernate.Session; | |
import org.hibernate.SessionFactory; | |
import org.springframework.beans.factory.annotation.Autowired; | |
@SuppressWarnings("unchecked") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AbstractUserDetailsAuthenticationProvider.badCredentials=Invalid username or password | |
AbstractUserDetailsAuthenticationProvider.locked=Your account is locked | |
AbstractUserDetailsAuthenticationProvider.disabled=Your account is disabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.bytestree.hibernate</groupId> | |
<artifactId>generic-dao-hibernate</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
<properties> | |
<spring.version>4.2.5.RELEASE</spring.version> | |
<hibernate.version>4.3.11.Final</hibernate.version> |
OlderNewer