app登录,浏览器登录开发完毕
This commit is contained in:
+1
-2
@@ -4,7 +4,6 @@ import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -16,7 +15,7 @@ import java.util.Map;
|
||||
public class MsJwtEnhancer implements TokenEnhancer{
|
||||
@Override
|
||||
public OAuth2AccessToken enhance(OAuth2AccessToken oAuth2AccessToken, OAuth2Authentication oAuth2Authentication) {
|
||||
//添加自定义的信息
|
||||
//添加自定义的信息,在这里面可以填入角色信息
|
||||
Map<String,Object> info = new HashMap<>();
|
||||
info.put("project","ms");
|
||||
((DefaultOAuth2AccessToken)oAuth2AccessToken).setAdditionalInformation(info);
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>boot-starter-security-sso-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>boot-starter-security-sso-server</name>
|
||||
<description>boot-starter-security-sso-server</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.micro.fast</groupId>
|
||||
<artifactId>boot-starter-security-sso</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-jwt</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!--最终打成jar的时候一定要去掉此插件,不然依赖他的项目会找不到这个依赖-->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>boot-starter-security-sso-server</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package com.micro.fast.security.sso.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* sso认证服务器
|
||||
* @author lsy
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class SsoServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SsoServerApplication.class,args);
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package com.micro.fast.security.sso.server.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
||||
|
||||
/**
|
||||
* sso单点登录认证中心
|
||||
* @author lsy
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAuthorizationServer
|
||||
public class SsoAuthorizationServerConfig extends AuthorizationServerConfigurerAdapter{
|
||||
@Override
|
||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
||||
clients.inMemory()
|
||||
.withClient("ms")
|
||||
.secret("ms")
|
||||
.authorizedGrantTypes("authorization_code","refresh_token")
|
||||
.scopes("all")
|
||||
.and()
|
||||
.withClient("ms2")
|
||||
.secret("ms2")
|
||||
.authorizedGrantTypes("authorization_code","refresh_token")
|
||||
.scopes("all");
|
||||
}
|
||||
}
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
|
||||
package com.micro.fast.security.sso.server;
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
server.port=9999
|
||||
server.context-path=/sso-server
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>boot-starter-security-sso</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>boot-starter-security-sso</name>
|
||||
<description>boot-starter-security-sso</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.micro.fast</groupId>
|
||||
<artifactId>boot-starter-security</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>boot-starter-security-sso-server</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>boot-starter-security-sso</finalName>
|
||||
</build>
|
||||
</project>
|
||||
@@ -16,7 +16,6 @@
|
||||
</parent>
|
||||
<modules>
|
||||
<module>boot-starter-security-core</module>
|
||||
<module>boot-starter-security-sso</module>
|
||||
<module>boot-starter-security-app</module>
|
||||
<module>boot-starter-security-browser</module>
|
||||
<module>boot-starter-security-demo</module>
|
||||
|
||||
Reference in New Issue
Block a user