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