Skip to content

Commit 9c0acf7

Browse files
authored
Bump scalecube-security -> 1.1.0.RC3 (#880)
* Bump scalecube-security -> 1.1.0.X * Fixed ServiceTokenAuthenticator
1 parent 438adc6 commit 9c0acf7

File tree

3 files changed

+5
-59
lines changed

3 files changed

+5
-59
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
<properties>
6262
<scalecube-cluster.version>2.6.18.RC12</scalecube-cluster.version>
63-
<scalecube-security.version>1.0.33.RC3</scalecube-security.version>
63+
<scalecube-security.version>1.1.0.RC3</scalecube-security.version>
6464

6565
<reactor.version>2020.0.32</reactor.version>
6666
<jackson.version>2.18.2</jackson.version>

services-security/src/main/java/io/scalecube/services/security/RetryStrategies.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

services-security/src/main/java/io/scalecube/services/security/ServiceTokenAuthenticator.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class ServiceTokenAuthenticator<T> implements Authenticator<T> {
2121
private JwtTokenResolver tokenResolver;
2222
private ServiceTokenMapper tokenMapper;
2323
private AuthDataMapper<T> authDataMapper;
24-
private Retry retryStrategy = RetryStrategies.noRetriesRetryStrategy();
24+
private Retry retryStrategy = Retry.max(0);
2525

2626
public ServiceTokenAuthenticator() {}
2727

@@ -88,15 +88,14 @@ public ServiceTokenAuthenticator<T> retryStrategy(Retry retryStrategy) {
8888
public Mono<T> apply(Map<String, String> credentials) {
8989
return Mono.defer(
9090
() -> {
91-
String serviceToken = tokenMapper.map(credentials);
91+
final var serviceToken = tokenMapper.map(credentials);
9292

9393
if (serviceToken == null) {
9494
throw new UnauthorizedException("Authentication failed");
9595
}
9696

97-
return tokenResolver
98-
.resolve(serviceToken)
99-
.map(authDataMapper::map)
97+
return Mono.fromFuture(tokenResolver.resolve(serviceToken))
98+
.map(token -> authDataMapper.map(token.payload()))
10099
.retryWhen(retryStrategy)
101100
.doOnError(th -> LOGGER.error("Failed to authenticate, cause: {}", th.toString()))
102101
.onErrorMap(th -> new UnauthorizedException("Authentication failed"))

0 commit comments

Comments
 (0)