日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

SpringSecurity分布式整合之认证模块搭建

發(fā)布時(shí)間:2024/4/14 javascript 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SpringSecurity分布式整合之认证模块搭建 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

認(rèn)證服務(wù)

創(chuàng)建認(rèn)證服務(wù)工程并導(dǎo)入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>

創(chuàng)建認(rèn)證服務(wù)配置文件

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);} }

創(chuàng)建認(rèn)證服務(wù)啟動(dòng)類

@SpringBootApplication @MapperScan("com.leon.mapper") @EnableConfigurationProperties(RsaKeyProperties.class) public class AuthApplication {public static void main(String[] args) {SpringApplication.run(AuthApplication.class, args);} }

總結(jié)

以上是生活随笔為你收集整理的SpringSecurity分布式整合之认证模块搭建的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。