feat:后置校验

This commit is contained in:
wangyu 2022-01-06 23:12:35 +08:00
parent 7c323c2753
commit f459899a53

View File

@ -96,13 +96,13 @@ public class MongoUserDetailsServiceImpl implements MongoUserDetailsService {
* @return 结果
*/
private Mono<UserDetails> validate(UserDetails details) {
if (details instanceof AdminUserDetails) {
AdminUserDetails user = (AdminUserDetails) details;
if (details instanceof IUser) {
IUser user = (IUser) details;
return checkMap.entrySet().stream()
.filter(entry -> entry.getKey().apply(user))
.findFirst()
.map(entry -> Mono.<UserDetails>error(entry.getValue().get()))
.orElse(Mono.just(user));
.orElse(Mono.just(details));
}
return Mono.just(details);
}