基于@EnableOAuth2Sso实现单点登录
This commit is contained in:
		@@ -2,6 +2,7 @@ package com.test;
 | 
			
		||||
 | 
			
		||||
import org.springframework.boot.SpringApplication;
 | 
			
		||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClassName: UserApplication
 | 
			
		||||
@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
 * @author yovinchen
 | 
			
		||||
 * @Create 2023/8/14 16:26
 | 
			
		||||
 */
 | 
			
		||||
@EnableOAuth2Sso
 | 
			
		||||
@SpringBootApplication
 | 
			
		||||
public class UserApplication {
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
 
 | 
			
		||||
@@ -6,3 +6,16 @@ spring:
 | 
			
		||||
    url: jdbc:mysql://43.143.164.194:3306/mac
 | 
			
		||||
    username: mac
 | 
			
		||||
    password: mactest
 | 
			
		||||
security:
 | 
			
		||||
  oauth2:
 | 
			
		||||
    client:
 | 
			
		||||
      #不多说了
 | 
			
		||||
      client-id: web
 | 
			
		||||
      client-secret: 654321
 | 
			
		||||
      #Token获取地址
 | 
			
		||||
      access-token-uri: http://localhost:8500/sso/oauth/token
 | 
			
		||||
      #验证页面地址
 | 
			
		||||
      user-authorization-uri: http://localhost:8500/sso/oauth/authorize
 | 
			
		||||
    resource:
 | 
			
		||||
      #Token信息获取和校验地址
 | 
			
		||||
      token-info-uri: http://localhost:8500/sso/oauth/check_token
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user