feat:同时支持同步和异步,以保证dbref暂时可用
This commit is contained in:
parent
95a35c35b9
commit
75b089c8ad
@ -33,6 +33,11 @@
|
||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
|
@ -2,6 +2,7 @@ package com.flyfish.framework.annotations;
|
||||
|
||||
import com.flyfish.framework.repository.factory.DefaultReactiveRepositoryFactoryBean;
|
||||
import com.flyfish.framework.repository.impl.DefaultReactiveRepositoryImpl;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import org.springframework.data.mongodb.config.EnableReactiveMongoAuditing;
|
||||
import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
|
||||
|
@ -24,6 +24,7 @@ public class ReactiveAuthorizeAuditor implements ReactiveBeanAuditor<AuthorizedD
|
||||
.map(user -> {
|
||||
data.setAuthorizeId(user.getAuthority());
|
||||
return data;
|
||||
});
|
||||
})
|
||||
.defaultIfEmpty(data);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class ReactiveOperationAuditor implements ReactiveBeanAuditor<AuditDomain
|
||||
data.setModifierId(user.getId());
|
||||
}
|
||||
return data;
|
||||
});
|
||||
})
|
||||
.defaultIfEmpty(data);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ public class UserBeanAuditor implements ReactiveBeanAuditor<User>, ReactiveBeanP
|
||||
@Override
|
||||
public Mono<User> post(User data) {
|
||||
// 更新缓存
|
||||
return reactiveRedisOperations.set(UserCacheKeys.get(data.getUsername()),
|
||||
userDetailsConverter.mapToUserDetails(data)).then(Mono.just(data));
|
||||
return userDetailsConverter.mapToUserDetails(data)
|
||||
.flatMap(detail -> reactiveRedisOperations.set(UserCacheKeys.get(data.getUsername()), detail))
|
||||
.thenReturn(data);
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,12 @@ public class JwtSecurityContextRepository implements ServerSecurityContextReposi
|
||||
*/
|
||||
@Override
|
||||
public Mono<Void> save(ServerWebExchange webExchange, SecurityContext securityContext) {
|
||||
if (null == securityContext) {
|
||||
return tokenProvider.removeToken(webExchange);
|
||||
} else {
|
||||
// 添加jwtToken
|
||||
tokenProvider.addToken(webExchange, securityContext.getAuthentication());
|
||||
}
|
||||
return Mono.empty();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user