mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-07-01 00:34:19 +08:00
优化权限管理
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
@@ -34,10 +40,12 @@
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
|
||||
@@ -51,14 +51,6 @@ public interface UserToken extends Serializable, Comparable<UserToken> {
|
||||
|
||||
long getMaxInactiveInterval();
|
||||
|
||||
/**
|
||||
* @return 是否正常
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean isEffective() {
|
||||
return isNormal();
|
||||
}
|
||||
|
||||
default boolean isNormal() {
|
||||
return getState() == TokenState.normal;
|
||||
}
|
||||
|
||||
@@ -71,12 +71,7 @@ public class UserTokenReactiveAuthenticationSupplier implements ReactiveAuthenti
|
||||
context.get(ContextKey.of(ParsedToken.class))
|
||||
.map(t -> userTokenManager
|
||||
.getByToken(t.getToken())
|
||||
.map(token -> {
|
||||
if (!token.isNormal()) {
|
||||
throw new UnAuthorizedException(token.getState());
|
||||
}
|
||||
return token;
|
||||
}))
|
||||
.filter(UserToken::validate))
|
||||
.map(tokenMono -> tokenMono
|
||||
.doOnNext(token->userTokenManager.touch(token.getToken()))
|
||||
.flatMap(token -> get(thirdPartAuthenticationManager.get(token.getType()), token.getUserId())))
|
||||
|
||||
Reference in New Issue
Block a user