mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
feat:登出将JWT加入黑名单
This commit is contained in:
parent
c3f37a18f2
commit
adee1ae2dc
@ -6,6 +6,8 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
@ -14,6 +16,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.security.Principal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "认证中心认证登录")
|
||||
@ -24,6 +27,9 @@ public class AuthController {
|
||||
@Resource
|
||||
private TokenEndpoint tokenEndpoint;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@ApiOperation("Oauth2获取token")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "grant_type",paramType = "query", defaultValue = "password", value = "授权模式", required = true),
|
||||
@ -46,4 +52,14 @@ public class AuthController {
|
||||
.build();
|
||||
return Result.success(oauth2Token);
|
||||
}
|
||||
|
||||
@DeleteMapping("/logout")
|
||||
public Result logout(){
|
||||
|
||||
//redisTemplate.opsForHash().putAll("",new ArrayList<>());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user