SpringSecurity入门demo

pom依赖

    
        5.0.2.RELEASE
        1.6.6
        1.2.12
        1.2.3
        3.4.5
        5.0.1.RELEASE
    
    
        
        
            org.aspectj
            aspectjweaver
            1.6.8
        
        
            org.springframework
            spring-context
            ${spring.version}
        
        
            org.springframework
            spring-context-support
            ${spring.version}
        
        
            org.springframework
            spring-orm
            ${spring.version}
        
        
            org.springframework
            spring-test
            ${spring.version}
        
        
            org.springframework
            spring-webmvc
            ${spring.version}
        
        
            junit
            junit
            4.12
            test
        
        
            mysql
            mysql-connector-java
            5.1.6
        

        
            javax.servlet
            javax.servlet-api
            3.1.0
            provided
        
        
            javax.servlet.jsp
            jsp-api
            2.0
            provided
        
        
            jstl
            jstl
            1.2
        
        
        
            log4j
            log4j
            ${log4j.version}
        
        
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.slf4j
            slf4j-log4j12
            ${slf4j.version}
        
        
        
            org.mybatis
            mybatis
            ${mybatis.version}
        
        
            org.mybatis
            mybatis-spring
            1.3.0
        
        
            c3p0
            c3p0
            0.9.1.2
            jar
            compile
        
        
            com.github.pagehelper
            pagehelper
            5.1.2
        
        
            org.springframework.security
            spring-security-config
            ${spring.security.version}
        
        
            org.springframework.security
            spring-security-taglibs
            ${spring.security.version}
        
        
            com.alibaba
            druid
            1.0.9
        
        
            javax.annotation
            jsr250-api
            1.0
        
    
    
        
            
                org.apache.tomcat.maven
                tomcat7-maven-plugin
                2.2
            
        
    

web.xml配置

 整合加上注意加上这个监听器
z
    org.springframework.web.context.ContextLoaderListener


    contextConfigLocation
    classpath:springSecurty.xml



    springSecurityFilterChain
    org.springframework.web.filter.DelegatingFilterProxy


    springSecurityFilterChain
    /*

SpringSecurity配置文件中配置




    
    
    
    
    
 

    
    
    
    
    
    

    
    




    
    
        
            
                
                
            
        
    

简单的认证页面

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    认证页面


//主要是路径后的/login处理器
用户名: 密码:

认证成功页面

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    认证成功页面


退出登录


认证失败页面

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    登录失败页面


认证失败!!!!

默认Index页面(在没有指定页面时会默认跳转到此页面)


<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    项目的首页


项目的首页


退出登录

 

你可能感兴趣的:(SpringSecurity入门demo)