Skip to content

Commit 775ee5c

Browse files
committed
Added more classes to api.auth package, removed dep on slf4j-api from services-api
1 parent f56e900 commit 775ee5c

File tree

7 files changed

+29
-27
lines changed

7 files changed

+29
-27
lines changed

services-api/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
<groupId>io.projectreactor</groupId>
1919
<artifactId>reactor-core</artifactId>
2020
</dependency>
21-
<dependency>
22-
<groupId>org.slf4j</groupId>
23-
<artifactId>slf4j-api</artifactId>
24-
</dependency>
2521
</dependencies>
2622

2723
</project>

services-api/src/main/java/io/scalecube/services/ServiceCall.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@
2222
import java.util.Optional;
2323
import java.util.function.Function;
2424
import org.reactivestreams.Publisher;
25-
import org.slf4j.Logger;
26-
import org.slf4j.LoggerFactory;
2725
import reactor.core.Exceptions;
2826
import reactor.core.publisher.Flux;
2927
import reactor.core.publisher.Mono;
3028

3129
public class ServiceCall {
3230

33-
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCall.class);
34-
3531
private ClientTransport transport;
3632
private ServiceRegistry serviceRegistry;
3733
private Router router;
@@ -355,14 +351,12 @@ private ServiceMessage toServiceMessage(MethodInfo methodInfo, Object request) {
355351
.build();
356352
}
357353

358-
private ServiceUnavailableException noReachableMemberException(ServiceMessage request) {
359-
LOGGER.error(
360-
"Failed to invoke service, "
361-
+ "No reachable member with such service definition [{}], args [{}]",
362-
request.qualifier(),
363-
request);
354+
private static ServiceUnavailableException noReachableMemberException(ServiceMessage request) {
364355
return new ServiceUnavailableException(
365-
"No reachable member with such service: " + request.qualifier());
356+
"No reachable member with such service: "
357+
+ request.qualifier()
358+
+ ", failed request: "
359+
+ request);
366360
}
367361

368362
/**
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.scalecube.services.auth;
2+
3+
import java.util.Map;
4+
import reactor.core.publisher.Mono;
5+
6+
public interface CredentialsSupplier {
7+
8+
Mono<Map<String, String>> credentials(Map<String, String> tags);
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.scalecube.services.auth;
2+
3+
public interface CredentialsSuppliers {
4+
5+
CredentialsSupplier forServiceRole(String serviceRole);
6+
}

services-api/src/main/java/io/scalecube/services/methods/ServiceMethodInvoker.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@
1717
import java.util.Optional;
1818
import java.util.StringJoiner;
1919
import org.reactivestreams.Publisher;
20-
import org.slf4j.Logger;
21-
import org.slf4j.LoggerFactory;
2220
import reactor.core.publisher.Flux;
2321
import reactor.core.publisher.Mono;
2422
import reactor.util.context.Context;
2523

2624
public final class ServiceMethodInvoker {
2725

28-
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceMethodInvoker.class);
29-
3026
private final Method method;
3127
private final Object service;
3228
private final MethodInfo methodInfo;
@@ -164,8 +160,8 @@ private Mono<Object> authenticate(ServiceMessage message, Context context) {
164160
if (context.hasKey(AUTH_CONTEXT_KEY)) {
165161
return Mono.just(context.get(AUTH_CONTEXT_KEY));
166162
} else {
167-
LOGGER.error("Authentication failed (auth context not found and authenticator not set)");
168-
throw new UnauthorizedException("Authentication failed");
163+
throw new UnauthorizedException(
164+
"Authentication failed (auth context not found and authenticator not set)");
169165
}
170166
}
171167

services-api/src/main/java/io/scalecube/services/routing/Routers.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package io.scalecube.services.routing;
22

33
import java.util.concurrent.ConcurrentHashMap;
4-
import org.slf4j.Logger;
5-
import org.slf4j.LoggerFactory;
64
import reactor.core.Exceptions;
75

86
public final class Routers {
9-
private static final Logger LOGGER = LoggerFactory.getLogger(Routers.class);
107

118
private static final ConcurrentHashMap<Class<? extends Router>, Router> routers =
129
new ConcurrentHashMap<>();
@@ -28,7 +25,6 @@ private static Router create(Class<? extends Router> routerType) {
2825
try {
2926
return routerType.newInstance();
3027
} catch (Exception ex) {
31-
LOGGER.error("Create router type: {} failed: {}", routerType, ex);
3228
throw Exceptions.propagate(ex);
3329
}
3430
}

services/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<parent>
@@ -22,7 +24,10 @@
2224
<groupId>io.projectreactor</groupId>
2325
<artifactId>reactor-core</artifactId>
2426
</dependency>
25-
27+
<dependency>
28+
<groupId>org.slf4j</groupId>
29+
<artifactId>slf4j-api</artifactId>
30+
</dependency>
2631
<dependency>
2732
<groupId>org.jctools</groupId>
2833
<artifactId>jctools-core</artifactId>

0 commit comments

Comments
 (0)