feat:后置校验
This commit is contained in:
parent
7c323c2753
commit
f459899a53
@ -96,13 +96,13 @@ public class MongoUserDetailsServiceImpl implements MongoUserDetailsService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
private Mono<UserDetails> validate(UserDetails details) {
|
private Mono<UserDetails> validate(UserDetails details) {
|
||||||
if (details instanceof AdminUserDetails) {
|
if (details instanceof IUser) {
|
||||||
AdminUserDetails user = (AdminUserDetails) details;
|
IUser user = (IUser) details;
|
||||||
return checkMap.entrySet().stream()
|
return checkMap.entrySet().stream()
|
||||||
.filter(entry -> entry.getKey().apply(user))
|
.filter(entry -> entry.getKey().apply(user))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(entry -> Mono.<UserDetails>error(entry.getValue().get()))
|
.map(entry -> Mono.<UserDetails>error(entry.getValue().get()))
|
||||||
.orElse(Mono.just(user));
|
.orElse(Mono.just(details));
|
||||||
}
|
}
|
||||||
return Mono.just(details);
|
return Mono.just(details);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user