OAuth2RestTemplate实现远程调用
This commit is contained in:
		@@ -3,6 +3,7 @@ package com.test;
 | 
			
		||||
import org.springframework.boot.SpringApplication;
 | 
			
		||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
			
		||||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
 | 
			
		||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ClassName: UserApplication
 | 
			
		||||
@@ -11,7 +12,7 @@ import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth
 | 
			
		||||
 * @author yovinchen
 | 
			
		||||
 * @Create 2023/8/14 16:26
 | 
			
		||||
 */
 | 
			
		||||
@EnableOAuth2Sso
 | 
			
		||||
@EnableResourceServer
 | 
			
		||||
@SpringBootApplication
 | 
			
		||||
public class UserApplication {
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,13 +9,9 @@ spring:
 | 
			
		||||
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是否有访问此资源的权限以及用户信息,所以只需要一个验证地址
 | 
			
		||||
      token-info-uri: http://localhost:8500/sso/oauth/check_token
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user