Skip to content

Commit

Permalink
release 4.2.0, fixes #159
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Furer committed Oct 21, 2020
1 parent 5ea3c6d commit cdf0899
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 39 deletions.
18 changes: 16 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,34 @@ Starting from release `4.0.0` the starter is compiled and tested against Spring

== Setup

[source,gradle]
[source,groovy]
----
repositories {
mavenCentral()
//maven { url "https://oss.sonatype.org/content/repositories/snapshots" } //for snashot builds
}
dependencies {
compile 'io.github.lognet:grpc-spring-boot-starter:4.1.0'
compile 'io.github.lognet:grpc-spring-boot-starter:4.2.0'
}
----

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. +
In this case you'll need to forcibly and implicitly set the `grpc` version to use (see link:ReleaseNotes.adoc[version matrix here^] ):

[source,groovy]
----
configurations.all {
resolutionStrategy.eachDependency { details ->
if ("io.grpc".equalsIgnoreCase(details.requested.group)) {
details.useVersion "1.33.0"
}
}
}
----

[IMPORTANT]
Starting from release `3.0.0` the artifacts are published to *maven central*.
Pay attention that `group` has changed from `org.lognet` to `io.github.lognet`.
Expand Down
6 changes: 5 additions & 1 deletion ReleaseNotes.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
== Version 4.2.0
* gRPC version upgraded to 1.33.0
* Fixed the issue with default method-level `@Secured` annotation (see #159)
== Version 4.1.0
* gRPC version upgraded to 1.31.2
* gRPC version upgraded to 1.32.2
* Fixed the issue with obtaining `Authentication` details in secured method implementation.
* Fixed the issue with providing client-side user credentials.

Expand Down
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
buildscript {
ext {
springBoot_2_X_Version = '2.3.3.RELEASE'
grpcVersion = '1.32.2'
}
repositories {
mavenCentral()
jcenter()
Expand Down
6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version=4.2.0-SNAPSHOT
grpcVersion=1.33.0
springBootVersion=2.3.3.RELEASE
springCloudVersion=Hoxton.SR6

version=4.2.0
group=io.github.lognet
description=Spring Boot starter for Google RPC.
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter
Expand Down
52 changes: 29 additions & 23 deletions grpc-spring-boot-starter-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBoot_2_X_Version}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
ext {
set('springCloudVersion', "Hoxton.SR6")



dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

dependencies {

compile "org.springframework.boot:spring-boot-starter-actuator"
compile 'org.springframework.boot:spring-boot-starter-web'
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation 'org.springframework.boot:spring-boot-starter-web'

compile "org.springframework.security:spring-security-config"
compile "org.springframework.security:spring-security-oauth2-jose"
compile "org.springframework.security:spring-security-oauth2-resource-server"
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-oauth2-jose"
implementation "org.springframework.security:spring-security-oauth2-resource-server"


compile project(':grpc-spring-boot-starter')
compile project(':grpc-client-spring-boot-starter')
implementation project(':grpc-spring-boot-starter')
implementation project(':grpc-client-spring-boot-starter')

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



testImplementation 'org.hamcrest:hamcrest:2.1'

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



//testCompile "org.testcontainers:junit-jupiter:1.14.3"


}

configurations.all {
resolutionStrategy.eachDependency { details ->
if ("io.grpc".equalsIgnoreCase(details.requested.group)) {
details.useVersion grpcVersion
}
}
}
sourceSets {
main {
Expand All @@ -71,7 +83,7 @@ protobuf {
generateProtoTasks {
ofSourceSet('main').each { task ->
task.builtins {
java{
java {
outputSubDir = 'protoGen'
}
}
Expand All @@ -85,20 +97,14 @@ protobuf {
generatedFilesBaseDir = "$projectDir/src/"
}

task cleanProtoGen{
doFirst{
delete("$projectDir/src/main/protoGen")
task cleanProtoGen {
doFirst {
delete("$projectDir/src/main/protoGen")
}
}
clean.dependsOn cleanProtoGen


dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBoot_2_X_Version}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.32.2)",
value = "by gRPC proto compiler (version 1.33.0)",
comments = "Source: calculator.proto")
public final class CalculatorGrpc {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.32.2)",
value = "by gRPC proto compiler (version 1.33.0)",
comments = "Source: greeter.proto")
public final class GreeterGrpc {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.32.2)",
value = "by gRPC proto compiler (version 1.33.0)",
comments = "Source: greeter.proto")
public final class SecuredGreeterGrpc {

Expand Down
2 changes: 1 addition & 1 deletion grpc-spring-boot-starter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBoot_2_X_Version}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "io.franzbecker:gradle-lombok:4.0.0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
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 @@ -118,10 +120,7 @@ public GrpcSecurity withSecuredAnnotation() {
// method level security
for(ServerMethodDefinition<?,?> methodDefinition :serverServiceDefinition.getMethods()){
Stream.of(service.getClass().getMethods()) // get method from methodDefinition
.filter(m -> {
final String methodName = methodDefinition.getMethodDescriptor().getFullMethodName().substring(methodDefinition.getMethodDescriptor().getServiceName().length() + 1);
return methodName.equalsIgnoreCase(m.getName());
})
.filter(m -> 0==Objects.compare(methodDefinition.getMethodDescriptor().getBareMethodName(),m.getName(), Comparator.naturalOrder()))
.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 cdf0899

Please sign in to comment.