Skip to content

Commit cdf0899

Browse files
author
Alexander Furer
committed
release 4.2.0, fixes #159
1 parent 5ea3c6d commit cdf0899

File tree

10 files changed

+62
-39
lines changed

10 files changed

+62
-39
lines changed

README.adoc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,34 @@ Starting from release `4.0.0` the starter is compiled and tested against Spring
2323

2424
== Setup
2525

26-
[source,gradle]
26+
[source,groovy]
2727
----
2828
repositories {
2929
mavenCentral()
3030
//maven { url "https://oss.sonatype.org/content/repositories/snapshots" } //for snashot builds
3131
3232
}
3333
dependencies {
34-
compile 'io.github.lognet:grpc-spring-boot-starter:4.1.0'
34+
compile 'io.github.lognet:grpc-spring-boot-starter:4.2.0'
3535
}
3636
3737
3838
----
3939

40+
If you are using Spring Boot Dependency Management plugin, it might pull not the same version as the version this started was compiled against, causing binary incompatibility issue. +
41+
In this case you'll need to forcibly and implicitly set the `grpc` version to use (see link:ReleaseNotes.adoc[version matrix here^] ):
42+
43+
[source,groovy]
44+
----
45+
configurations.all {
46+
resolutionStrategy.eachDependency { details ->
47+
if ("io.grpc".equalsIgnoreCase(details.requested.group)) {
48+
details.useVersion "1.33.0"
49+
}
50+
}
51+
}
52+
----
53+
4054
[IMPORTANT]
4155
Starting from release `3.0.0` the artifacts are published to *maven central*.
4256
Pay attention that `group` has changed from `org.lognet` to `io.github.lognet`.

ReleaseNotes.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
== Version 4.2.0
2+
* gRPC version upgraded to 1.33.0
3+
* Fixed the issue with default method-level `@Secured` annotation (see #159)
4+
15
== Version 4.1.0
2-
* gRPC version upgraded to 1.31.2
6+
* gRPC version upgraded to 1.32.2
37
* Fixed the issue with obtaining `Authentication` details in secured method implementation.
48
* Fixed the issue with providing client-side user credentials.
59

build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
buildscript {
2-
ext {
3-
springBoot_2_X_Version = '2.3.3.RELEASE'
4-
grpcVersion = '1.32.2'
5-
}
62
repositories {
73
mavenCentral()
84
jcenter()

gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
version=4.2.0-SNAPSHOT
1+
grpcVersion=1.33.0
2+
springBootVersion=2.3.3.RELEASE
3+
springCloudVersion=Hoxton.SR6
4+
5+
version=4.2.0
26
group=io.github.lognet
37
description=Spring Boot starter for Google RPC.
48
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter

grpc-spring-boot-starter-demo/build.gradle

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
1-
21
buildscript {
32
repositories {
43
mavenCentral()
54
}
65
dependencies {
7-
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBoot_2_X_Version}")
6+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
87
}
98
}
109
apply plugin: 'java'
1110
apply plugin: 'com.google.protobuf'
1211
apply plugin: 'org.springframework.boot'
1312
apply plugin: 'io.spring.dependency-management'
14-
ext {
15-
set('springCloudVersion', "Hoxton.SR6")
1613

14+
15+
16+
dependencyManagement {
17+
imports {
18+
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
19+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
20+
}
1721
}
22+
1823
dependencies {
1924

20-
compile "org.springframework.boot:spring-boot-starter-actuator"
21-
compile 'org.springframework.boot:spring-boot-starter-web'
25+
implementation "org.springframework.boot:spring-boot-starter-actuator"
26+
implementation 'org.springframework.boot:spring-boot-starter-web'
2227

23-
compile "org.springframework.security:spring-security-config"
24-
compile "org.springframework.security:spring-security-oauth2-jose"
25-
compile "org.springframework.security:spring-security-oauth2-resource-server"
28+
implementation "org.springframework.security:spring-security-config"
29+
implementation "org.springframework.security:spring-security-oauth2-jose"
30+
implementation "org.springframework.security:spring-security-oauth2-resource-server"
2631

2732

28-
compile project(':grpc-spring-boot-starter')
29-
compile project(':grpc-client-spring-boot-starter')
33+
implementation project(':grpc-spring-boot-starter')
34+
implementation project(':grpc-client-spring-boot-starter')
3035

3136
testCompile 'org.springframework.boot:spring-boot-starter-aop'
3237
testCompile 'org.springframework.boot:spring-boot-starter-test'
@@ -40,15 +45,22 @@ dependencies {
4045
testRuntime "org.springframework.cloud:spring-cloud-starter"
4146

4247

43-
4448
testImplementation 'org.hamcrest:hamcrest:2.1'
4549

4650
testImplementation 'org.mockito:mockito-core:2.23.0'
4751

4852

49-
5053
//testCompile "org.testcontainers:junit-jupiter:1.14.3"
5154

55+
56+
}
57+
58+
configurations.all {
59+
resolutionStrategy.eachDependency { details ->
60+
if ("io.grpc".equalsIgnoreCase(details.requested.group)) {
61+
details.useVersion grpcVersion
62+
}
63+
}
5264
}
5365
sourceSets {
5466
main {
@@ -71,7 +83,7 @@ protobuf {
7183
generateProtoTasks {
7284
ofSourceSet('main').each { task ->
7385
task.builtins {
74-
java{
86+
java {
7587
outputSubDir = 'protoGen'
7688
}
7789
}
@@ -85,20 +97,14 @@ protobuf {
8597
generatedFilesBaseDir = "$projectDir/src/"
8698
}
8799

88-
task cleanProtoGen{
89-
doFirst{
90-
delete("$projectDir/src/main/protoGen")
100+
task cleanProtoGen {
101+
doFirst {
102+
delete("$projectDir/src/main/protoGen")
91103
}
92104
}
93105
clean.dependsOn cleanProtoGen
94106

95107

96-
dependencyManagement {
97-
imports {
98-
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBoot_2_X_Version}"
99-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
100-
}
101-
}
102108

103109

104110

grpc-spring-boot-starter-demo/src/main/protoGen/io/grpc/examples/CalculatorGrpc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
*/
1212
@javax.annotation.Generated(
13-
value = "by gRPC proto compiler (version 1.32.2)",
13+
value = "by gRPC proto compiler (version 1.33.0)",
1414
comments = "Source: calculator.proto")
1515
public final class CalculatorGrpc {
1616

grpc-spring-boot-starter-demo/src/main/protoGen/io/grpc/examples/GreeterGrpc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* </pre>
1414
*/
1515
@javax.annotation.Generated(
16-
value = "by gRPC proto compiler (version 1.32.2)",
16+
value = "by gRPC proto compiler (version 1.33.0)",
1717
comments = "Source: greeter.proto")
1818
public final class GreeterGrpc {
1919

grpc-spring-boot-starter-demo/src/main/protoGen/io/grpc/examples/SecuredGreeterGrpc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
*/
1212
@javax.annotation.Generated(
13-
value = "by gRPC proto compiler (version 1.32.2)",
13+
value = "by gRPC proto compiler (version 1.33.0)",
1414
comments = "Source: greeter.proto")
1515
public final class SecuredGreeterGrpc {
1616

grpc-spring-boot-starter/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBoot_2_X_Version}")
7+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
88
classpath "io.franzbecker:gradle-lombok:4.0.0"
99
}
1010
}

grpc-spring-boot-starter/src/main/java/org/lognet/springboot/grpc/security/GrpcServiceAuthorizationConfigurer.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
import java.util.Arrays;
1919
import java.util.Collection;
2020
import java.util.Collections;
21+
import java.util.Comparator;
2122
import java.util.List;
23+
import java.util.Objects;
2224
import java.util.Optional;
2325
import java.util.stream.Collectors;
2426
import java.util.stream.Stream;
@@ -118,10 +120,7 @@ public GrpcSecurity withSecuredAnnotation() {
118120
// method level security
119121
for(ServerMethodDefinition<?,?> methodDefinition :serverServiceDefinition.getMethods()){
120122
Stream.of(service.getClass().getMethods()) // get method from methodDefinition
121-
.filter(m -> {
122-
final String methodName = methodDefinition.getMethodDescriptor().getFullMethodName().substring(methodDefinition.getMethodDescriptor().getServiceName().length() + 1);
123-
return methodName.equalsIgnoreCase(m.getName());
124-
})
123+
.filter(m -> 0==Objects.compare(methodDefinition.getMethodDescriptor().getBareMethodName(),m.getName(), Comparator.naturalOrder()))
125124
.findFirst()
126125
.flatMap(m->Optional.ofNullable(AnnotationUtils.findAnnotation(m, Secured.class)))
127126
.ifPresent(secured -> new AuthorizedMethod(methodDefinition.getMethodDescriptor()) .hasAnyAuthority(secured.value()));

0 commit comments

Comments
 (0)