|
|
@@ -5,6 +5,7 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.modules.auth.entity.OauthTokenDto;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
|
|
+import org.springframework.security.oauth2.provider.endpoint.CheckTokenEndpoint;
|
|
|
import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint;
|
|
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -28,6 +29,8 @@ public class AuthController {
|
|
|
|
|
|
@Autowired
|
|
|
private TokenEndpoint tokenEndpoint;
|
|
|
+ @Autowired
|
|
|
+ private CheckTokenEndpoint checkTokenEndpoint;
|
|
|
|
|
|
/**
|
|
|
* Oauth2登录认证
|
|
|
@@ -43,4 +46,18 @@ public class AuthController {
|
|
|
.tokenType(oAuth2AccessToken.getTokenType()).build();
|
|
|
return Result.ok(oauth2TokenDto);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证access_token
|
|
|
+ *
|
|
|
+ * @param value
|
|
|
+ * @return
|
|
|
+ * @throws HttpRequestMethodNotSupportedException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/check_token")
|
|
|
+ public Result<?> checkAccessToken(@RequestParam("token") String value) {
|
|
|
+ log.info("验证access_token=====,{}", value);
|
|
|
+ Map<String, ?> response = checkTokenEndpoint.checkToken(value);
|
|
|
+ return Result.ok(response);
|
|
|
+ }
|
|
|
}
|