Skip to content

Commit

Permalink
release 4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Furer committed Nov 2, 2020
1 parent 4bf2678 commit d783ca8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
dependencies {
compile 'io.github.lognet:grpc-spring-boot-starter:4.2.1'
compile 'io.github.lognet:grpc-spring-boot-starter:4.2.2'
}
Expand Down
3 changes: 3 additions & 0 deletions ReleaseNotes.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
== Version 4.2.2
* Fixes https://github.com/LogNet/grpc-spring-boot-starter/issues/162[162]
== Version 4.2.1

* Configure bind address and other netty settings (fixes https://github.com/LogNet/grpc-spring-boot-starter/issues/82[82])
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ grpcVersion=1.33.0
springBootVersion=2.3.4.RELEASE
springCloudVersion=Hoxton.SR6

version=4.2.2-SNAPSHOT
version=4.2.2
group=io.github.lognet
description=Spring Boot starter for Google RPC.
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import com.google.protobuf.Empty;
import io.grpc.examples.GreeterGrpc;
import io.grpc.examples.SecuredGreeterGrpc;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -44,4 +45,14 @@ public void securedServiceTest() {
assertTrue(String.format("Reply should contain name '%s'",USER_NAME),reply.contains(USER_NAME));

}
@Test
public void securedServiceMethodTest() {

final GreeterGrpc.GreeterBlockingStub securedFutureStub = GreeterGrpc.newBlockingStub(getChannel(true));

final String reply = securedFutureStub.sayAuthHello(Empty.getDefaultInstance()).getMessage();
assertNotNull("Reply should not be null",reply);
assertTrue(String.format("Reply should contain name '%s'",USER_NAME),reply.contains(USER_NAME));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -139,7 +137,7 @@ private void processSecuredAnnotation() {
// method level security
for (ServerMethodDefinition<?, ?> methodDefinition : serverServiceDefinition.getMethods()) {
Stream.of(service.getClass().getMethods()) // get method from methodDefinition
.filter(m -> 0 == Objects.compare(methodDefinition.getMethodDescriptor().getBareMethodName(), m.getName(), Comparator.naturalOrder()))
.filter(m -> m.getName().equalsIgnoreCase(methodDefinition.getMethodDescriptor().getBareMethodName()))
.findFirst()
.flatMap(m -> Optional.ofNullable(AnnotationUtils.findAnnotation(m, Secured.class)))
.ifPresent(secured -> new AuthorizedMethod(methodDefinition.getMethodDescriptor()).hasAnyAuthority(secured.value()));
Expand Down

0 comments on commit d783ca8

Please sign in to comment.