SpringSecurity分布式整合之认证模块搭建
认证服务
创建认证服务工程并导入jar包
<?xml version="1.0" encoding="UTF-8"?>
<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"><parent><artifactId>springboot_security_jwt_rsa_parent</artifactId><groupId>com.leon</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>leon_auth_server</artifactId><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><dependency><groupId>com.leon</groupId><artifactId>leon_common</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.47</version></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.1.0</version></dependency></dependencies>
</project>
创建认证服务配置文件
server:port: 9001
spring:datasource:driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql:///security_authorityusername: rootpassword: root
mybatis:type-aliases-package: com.leon.domainconfiguration:map-underscore-to-camel-case: true
logging:level:com.leon: debug
rsa:key:pubKeyFile: D:\auth_key\id_key_rsa.pubpriKeyFile: D:\auth_key\id_key_rsa
提供解析公钥和私钥的配置类
@Data
@ConfigurationProperties(prefix = "leon.key")
public class RsaKeyProperties {private String pubKeyPath;private String priKeyPath;private PublicKey publicKey;private PrivateKey privateKey;@PostConstructpublic void loadKey() throws Exception {publicKey = RsaUtils.getPublicKey(pubKeyPath);privateKey = RsaUtils.getPrivateKey(priKeyPath);}
}
创建认证服务启动类
@SpringBootApplication
@MapperScan("com.leon.mapper")
@EnableConfigurationProperties(RsaKeyProperties.class)
public class AuthApplication {public static void main(String[] args) {SpringApplication.run(AuthApplication.class, args);}
}
SpringSecurity分布式整合之认证模块搭建相关推荐
- SpringSecurity分布式整合之资源服务器搭建和测试
资源服务 说明 资源服务可以有很多个,这里只拿产品服务为例,记住,资源服务中只能通过公钥验证认证.不能签发token! 创建产品服务并导入jar包 根据实际业务导包即可,咱们就暂时和认证服务一样了. ...
- SpringSecurity分布式整合之分布式认证流程说明
分布式认证概念说明 分布式认证,即我们常说的单点登录,简称SSO,指的是在多应用系统的项目中,用户只需要登录一次,就可以访 问所有互相信任的应用系统. 分布式认证流程图 首先,我们要明确,在分布式项目 ...
- SpringSecurity分布式整合之common工具模块创建
通用模块 创建通用子模块并导入JWT相关jar包 <?xml version="1.0" encoding="UTF-8"?> <projec ...
- SpringSecurity分布式整合之验证认证的过滤器
编写检验token过滤器 public class JwtVerifyFilter extends BasicAuthenticationFilter {private RsaKeyPropertie ...
- SpringSecurity分布式整合之实现思路分析
JWT相关工具类 jar包 <dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt ...
- SpringSecurity分布式整合之认证服务配置文件编写和测试
编写SpringSecurity配置类 @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled=tru ...
- SpringSecurity分布式整合之jwt和rsa说明
JWT介绍 概念说明 从分布式认证流程中,我们不难发现,这中间起最关键作用的就是token,token的安全与否,直接关系到系统的 健壮性,这里我们选择使用JWT来实现token的生成和校验. JWT ...
- 一文梳理SpringSecurity中的登录认证流程
前言 SpringSecurity作为一个出自Spring家族很强大的安全框架时长被引用到SpringBoot项目中用作登录认证和授权模块使用,但是对于大部分使用者来说都只停留在实现使用用户名和密码的 ...
- 厉害,我带的实习生仅用四步就整合好SpringSecurity+JWT实现登录认证
小二是新来的实习生,作为技术 leader,我还是很负责任的,有什么锅都想甩给他,啊,不,一不小心怎么把心里话全说出来了呢?重来! 小二是新来的实习生,作为技术 leader,我还是很负责任的,有什么 ...
最新文章
- Chkconfig命令
- python学习笔记 day25 封装
- 大话设计模式C++版——装饰模式
- 激进的中国技术选型,给世界技术的发展带来了什么?
- (译)如何优化cocos2d程序的内存使用和程序大小:第二部分(完)
- 应用服务器Glassfish任意文件读取漏洞
- 云计算虚拟化之Docker上如何安装Mongodb?
- 【转】我应该直接学Swift还是Objective-C?
- 使用Docker部署mongo后 使用Robo 3T、Studio 3T( MongoChef )在 create databse 创建数据库时的掉坑笔记
- json-server安装报错问题
- 单目标跟踪、多目标跟踪、单目标跟踪发展现状、多目标跟踪发展现状
- Js实现炫酷随机抽人
- 计算机怎么设置ie连接网络连接不上去,有网络连接,但浏览器不能上网怎么办?电脑高手教你怎么解决...
- Apache 重写规则及参数详解,入门看这个就够了
- msxml3.dll 错误 '80072efd' A connection with the server could not be established
- Java基础篇--集合(collection)
- 给客户一个“无法拒绝”的SaaS?——6年三个SaaS项目后的感触
- 阿里巴巴FastJson整理(20分钟阅读)
- android仿酷狗界面,Android仿酷狗动感歌词(支持翻译和音译歌词)显示效果
- ubuntu系统搭建steam饥荒联机服务器