Skip to content

Commit 1ef3709

Browse files
author
Alexander Furer
committed
release 4.5.9
1 parent 066c3a7 commit 1ef3709

File tree

5 files changed

+113
-11
lines changed

5 files changed

+113
-11
lines changed

README.adoc

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repositories {
3838
3939
}
4040
dependencies {
41-
compile 'io.github.lognet:grpc-spring-boot-starter:4.5.8'
41+
compile 'io.github.lognet:grpc-spring-boot-starter:4.5.9'
4242
}
4343
4444
@@ -683,24 +683,24 @@ By following this approach you also decouple the transport layer and business lo
683683
=== Setup
684684

685685
.Dependencies to implement authentiction scheme (to be added to server-side project)
686-
[cols="a,a"]
686+
[cols="1,4"]
687687
|===
688688
|Scheme |Dependencies
689689

690690
|Basic
691-
|
691+
a|
692692
* `org.springframework.security:spring-security-config`
693693

694694

695695
|Bearer
696-
|
696+
a|
697697
* `org.springframework.security:spring-security-config`
698698
* `org.springframework.security:spring-security-oauth2-jose`
699699
* `org.springframework.security:spring-security-oauth2-resource-server`
700700

701701

702702
|_Custom_
703-
|
703+
a|
704704
* `org.springframework.security:spring-security-config`
705705
* `your.custom.lib`
706706

@@ -805,6 +805,71 @@ public AuthenticationSchemeSelector myCustomSchemeSelector(){
805805

806806
<<Client side configuration support>> section explains how to pass custom authorization scheme and claim from GRPC client.
807807

808+
=== @PreAuthorize() and @PostAuthorize() support
809+
Starting from version `4.5.9` you can also use standard `@PreAuthorize` and `@PostAuthorize` annotations on grpc service methods and grpc service types.
810+
811+
.Referencing input/output object in expression
812+
[cols="1,1,2,6"]
813+
|===
814+
|Call Type |Input object ref |Output object ref | Sample
815+
816+
|Unary +
817+
(request-response)
818+
|By parameter name
819+
a|`returnObject`
820+
a|
821+
[source,java]
822+
----
823+
@Override
824+
@PreAuthorize("#person.age<12")
825+
@PostAuthorize("returnObject.description.length()>0")
826+
public void unary(Person person, StreamObserver<Assignment> responseObserver) {
827+
}
828+
----
829+
830+
|Input stream, +
831+
single response
832+
a|`#p0` or `#a0`
833+
a|`returnObject`
834+
a|
835+
[source,java]
836+
----
837+
@Override
838+
@PreAuthorize("#p0.getAge()<12")
839+
@PostAuthorize("returnObject.description.length()>0")
840+
public StreamObserver<Person> inStream(StreamObserver<Assignment> responseObserver) {
841+
}
842+
----
843+
844+
|Single request, +
845+
output stream
846+
|By parameter name
847+
a|`returnObject`
848+
a|
849+
[source,java]
850+
----
851+
@Override
852+
@PreAuthorize("#person.age<12")
853+
@PostAuthorize("returnObject.description.length()>0")
854+
public void outStream(Person person, StreamObserver<Assignment> responseObserver) {
855+
}
856+
----
857+
858+
|Bidi stream
859+
|`#p0` or `#a0`
860+
a|`returnObject`
861+
a|
862+
[source,java]
863+
----
864+
@Override
865+
@PreAuthorize("#p0.age<12")
866+
@PostAuthorize("returnObject.description.length()>0")
867+
public StreamObserver<Person> bidiStream(StreamObserver<Assignment> responseObserver) {
868+
}
869+
----
870+
|===
871+
872+
808873
=== Obtaining Authentication details
809874

810875
To obtain `Authentication` object in the implementation of *secured method*, please use below snippet
@@ -902,9 +967,30 @@ Starting from version `3.3.0`, the starter will auto-register the running grpc s
902967

903968
The registered service name will be prefixed with `grpc-` ,i.e. `grpc-${spring.application.name}` to not interfere with standard registered web-service name if you choose to run both embedded `Grpc` and `Web` servers. +
904969

905-
Setting `spring.cloud.consul.discovery.register-health-check` to true will register GRPC health check service with Consul.
970+
`ConsulDiscoveryProperties` are bound from configuration properties prefixed by `spring.cloud.consul.discovery` and then the values are overwritten by `grpc.consul.discovery` prefixed properties (if set). This allows you to have separate consul discovery configuration for `rest` and `grpc` services if you choose to expose both from your application.
971+
972+
[source,yml]
973+
----
974+
spring:
975+
cloud:
976+
consul:
977+
discovery:
978+
metadata:
979+
myKey: myValue <1>
980+
tags:
981+
- myWebTag <2>
982+
grpc:
983+
consul:
984+
discovery:
985+
tags:
986+
- myGrpcTag <3>
987+
----
988+
<1> Both `rest` and `grpc` services are registered with metadata `myKey=myValue`
989+
<2> Rest services are registered with `myWebTag`
990+
<3> Grpc services are registered with `myGrpcTag`
991+
992+
Setting `spring.cloud.consul.discovery.register-health-check` (or `grpc.consul.discovery.register-health-check`) to `true` will register GRPC health check service with Consul.
906993

907-
Tags could be set by defining `spring.cloud.consul.discovery.tags` property.
908994

909995
There are 4 supported registration modes :
910996

@@ -915,7 +1001,7 @@ Please note that default implementation https://github.com/grpc/grpc-java/blob/b
9151001
In this mode the running grpc server is registered as single service with check per each discovered `grpc` service.
9161002
. `STANDALONE_SERVICES` +
9171003
In this mode each discovered grpc service is registered as single service with single check. Each registered service is tagged by its own service name.
918-
. `NOOP` - no grpc services registered. This mode is usefull if you serve both `rest` and `grpc` services in your application, but for some reason, only `rest` services should be registered with Consul.
1004+
. `NOOP` - no grpc services registered. This mode is useful if you serve both `rest` and `grpc` services in your application, but for some reason, only `rest` services should be registered with Consul.
9191005

9201006
[source,yml]
9211007
.You can control the desired mode from application.properties

ReleaseNotes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| Starter Version | gRPC versions |Spring Boot version
22
| -------------------- |:-------------:|:------------------:|
3+
| [4.5.9](#version-459)| 1.41.0 |2.5.6 |
34
| [4.5.8](#version-458)| 1.41.0 |2.5.0 |
45
| [4.5.7](#version-457)| 1.40.1 |2.5.0 |
56
| [4.5.6](#version-456)| 1.40.0 |2.5.0 |
@@ -27,6 +28,21 @@
2728
| [4.0.0](#version-400)| 1.32.1 |2.3.3.RELEASE |
2829
| [3.5.7](#version-357)| 1.31.1 |1.5.13.RELEASE |
2930

31+
# Version 4.5.9
32+
## :star: New Features
33+
34+
- Support separate consul discovery properties for grpc and http services [#250](https://github.com/LogNet/grpc-spring-boot-starter/issues/250)
35+
- Add metadata to consul service discovery [#249](https://github.com/LogNet/grpc-spring-boot-starter/issues/249)
36+
- Spring security SPEL expressions support (`@PreAuthorize` and `@PostAuthorize`) [#175](https://github.com/LogNet/grpc-spring-boot-starter/issues/175)
37+
38+
## :lady_beetle: Bug Fixes
39+
40+
- Circular bean dependency since 4.5.8 [#253](https://github.com/LogNet/grpc-spring-boot-starter/issues/253)
41+
42+
## :hammer: Dependency Upgrades
43+
44+
- Upgrade spring boot to 2.5.6 [#255](https://github.com/LogNet/grpc-spring-boot-starter/issues/255)
45+
3046
# Version 4.5.8
3147
## :star: New Features
3248

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gradleErrorPronePluginVersion=2.0.2
55
errorProneVersion=2.7.1
66
lombokVersion=1.18.20
77

8-
version=4.5.9-SNAPSHOT
8+
version=4.5.9
99
group=io.github.lognet
1010
description=Spring Boot starter for Google RPC.
1111
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter

grpc-spring-boot-starter-gradle-plugin/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Bootstraps the project with `com.google.protobuf` gradle plugin (including `grp
2323
----
2424
plugins {
2525
id 'java'
26-
id "io.github.lognet.grpc-spring-boot" version '4.5.8'
26+
id "io.github.lognet.grpc-spring-boot" version '4.5.9'
2727
}
2828
2929
----

grpc-spring-boot-starter/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ task generateReleaseNotes(type: JavaExec, group: "documentation") {
5555
)
5656
doFirst {
5757
download {
58-
src 'https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.6/github-changelog-generator.jar'
58+
src 'https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.7/github-changelog-generator.jar'
5959
dest generator
6060
onlyIfModified true
6161
}

0 commit comments

Comments
 (0)