提交 adee1ae2 编写于 作者: H haoxr

feat:登出将JWT加入黑名单

上级 c3f37a18
......@@ -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;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册