Spring Security 配置实例

几天学习了一下Spring Security3.1,从官网下载了Spring Security3.1版别进行操练,通过屡次测验才摸清了其间的一些原理。自己不才,希望能协助大家。还有,这次我第2次写博客啊,文体不是很行。希望能让观看者不发生疲乏的感受,我现已心满意足了。
一、数据库构造
     先来看一下数据库构造,选用的是根据人物-资本-用户的权限办理规划。(MySql数据库)
    为了节约华章,只对对比重要的字段进行注释。
    1.用户表Users
    CREATE TABLE `users` (
       -- 账号是不是有限 1. 是 0.否
       `enable` int(11) default NULL,
       `password` varchar(255) default NULL,
       `account` varchar(255) default NULL,
       `id` int(11) NOT NULL auto_increment,
       PRIMARY KEY  (`id`)
    )
 
   2.人物表Roles
   CREATE TABLE `roles` (
     `enable` int(11) default NULL,
     `name` varchar(255) default NULL,
     `id` int(11) NOT NULL auto_increment,
     PRIMARY KEY  (`id`)
   )

Spring Security 配置实例

时间: 2024-08-27 04:29:38

Spring Security 配置实例的相关文章

spring security 应用实例

开篇说明 最近工作有权限控制的需求,所以看了一下spring的security,它提供了很好的安全服务: 参考文章:http://peiquan.blog.51cto.com/7518552/1384168 ; 在这里我使用第三种权限控制方法,即将用户,权限,资源使用数据库存储,并自定义过滤器,在配置文件里进行相应配置. 二.数据准备 --权限表 CREATE TABLE `authorities` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `autho

springboot学习总结(八)Spring security配置

(一)配置类 Spring security的配置和Spring MVC的配置类似,只需在一个配置类上注解@EnableWebSecurity(Springboot项目可以不用),并让这个类继承WebSecurityConfigurerAdapter. @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected

spring mvc 和spring security配置 web.xml设置

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://xmlns.jcp.o

Spring+hibernate 配置实例

转自:http://www.cnblogs.com/hongten/archive/2012/03/10/java_spring_hibernate.html 项目结构: http://www.cnblogs.com/hongten/gallery/image/112469.html 使用的jar包: hibernate核心安装包:hibernate3.jarlib\rquired\*.jarlib\optional\encache-1.2.3.jar    (二级缓存) lib\test\sl

spring mvc 和spring security配置 spring-servlet.xml和spring-security.xml设置

spring-servlet.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xmlns:mvc="htt

spring mvc ,spring security配置 spring-servlet.xml和spring-security.xml设置

spring-servlet.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xmlns:mvc="htt

spring security配置详解

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:sec="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchem

Spring事务配置实例

事务 一个使用 MyBatis-spring 的主要原因是它允许MyBatis 参与到 Spring 的事务管理中.而 不是给 MyBatis 创建一个新的特定的事务管理器,MyBatis-Spring 利用了存在于Spring 中的 DataSourceTransactionManager. 一旦 Spring 的PlatformTransactionManager 配置好了,你可以在 Spring 中以你通常的做 法来配置事务.@Transactional 注解和AOP(Aspect-Ori

WebFlux Spring Security配置

最小化可运行配置 package com.terwergreen.bugucms.config; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; i