Skip to content

Commit

Permalink
release 4.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Furer committed Nov 3, 2021
1 parent 066c3a7 commit 1ef3709
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 11 deletions.
102 changes: 94 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repositories {
}
dependencies {
compile 'io.github.lognet:grpc-spring-boot-starter:4.5.8'
compile 'io.github.lognet:grpc-spring-boot-starter:4.5.9'
}
Expand Down Expand Up @@ -683,24 +683,24 @@ By following this approach you also decouple the transport layer and business lo
=== Setup

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

|Basic
|
a|
* `org.springframework.security:spring-security-config`


|Bearer
|
a|
* `org.springframework.security:spring-security-config`
* `org.springframework.security:spring-security-oauth2-jose`
* `org.springframework.security:spring-security-oauth2-resource-server`


|_Custom_
|
a|
* `org.springframework.security:spring-security-config`
* `your.custom.lib`

Expand Down Expand Up @@ -805,6 +805,71 @@ public AuthenticationSchemeSelector myCustomSchemeSelector(){

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

=== @PreAuthorize() and @PostAuthorize() support
Starting from version `4.5.9` you can also use standard `@PreAuthorize` and `@PostAuthorize` annotations on grpc service methods and grpc service types.

.Referencing input/output object in expression
[cols="1,1,2,6"]
|===
|Call Type |Input object ref |Output object ref | Sample

|Unary +
(request-response)
|By parameter name
a|`returnObject`
a|
[source,java]
----
@Override
@PreAuthorize("#person.age<12")
@PostAuthorize("returnObject.description.length()>0")
public void unary(Person person, StreamObserver<Assignment> responseObserver) {
}
----

|Input stream, +
single response
a|`#p0` or `#a0`
a|`returnObject`
a|
[source,java]
----
@Override
@PreAuthorize("#p0.getAge()<12")
@PostAuthorize("returnObject.description.length()>0")
public StreamObserver<Person> inStream(StreamObserver<Assignment> responseObserver) {
}
----

|Single request, +
output stream
|By parameter name
a|`returnObject`
a|
[source,java]
----
@Override
@PreAuthorize("#person.age<12")
@PostAuthorize("returnObject.description.length()>0")
public void outStream(Person person, StreamObserver<Assignment> responseObserver) {
}
----

|Bidi stream
|`#p0` or `#a0`
a|`returnObject`
a|
[source,java]
----
@Override
@PreAuthorize("#p0.age<12")
@PostAuthorize("returnObject.description.length()>0")
public StreamObserver<Person> bidiStream(StreamObserver<Assignment> responseObserver) {
}
----
|===


=== Obtaining Authentication details

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

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. +

Setting `spring.cloud.consul.discovery.register-health-check` to true will register GRPC health check service with Consul.
`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.

[source,yml]
----
spring:
cloud:
consul:
discovery:
metadata:
myKey: myValue <1>
tags:
- myWebTag <2>
grpc:
consul:
discovery:
tags:
- myGrpcTag <3>
----
<1> Both `rest` and `grpc` services are registered with metadata `myKey=myValue`
<2> Rest services are registered with `myWebTag`
<3> Grpc services are registered with `myGrpcTag`

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.

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

There are 4 supported registration modes :

Expand All @@ -915,7 +1001,7 @@ Please note that default implementation https://github.com/grpc/grpc-java/blob/b
In this mode the running grpc server is registered as single service with check per each discovered `grpc` service.
. `STANDALONE_SERVICES` +
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.
. `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.
. `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.

[source,yml]
.You can control the desired mode from application.properties
Expand Down
16 changes: 16 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| Starter Version | gRPC versions |Spring Boot version
| -------------------- |:-------------:|:------------------:|
| [4.5.9](#version-459)| 1.41.0 |2.5.6 |
| [4.5.8](#version-458)| 1.41.0 |2.5.0 |
| [4.5.7](#version-457)| 1.40.1 |2.5.0 |
| [4.5.6](#version-456)| 1.40.0 |2.5.0 |
Expand Down Expand Up @@ -27,6 +28,21 @@
| [4.0.0](#version-400)| 1.32.1 |2.3.3.RELEASE |
| [3.5.7](#version-357)| 1.31.1 |1.5.13.RELEASE |

# Version 4.5.9
## :star: New Features

- Support separate consul discovery properties for grpc and http services [#250](https://github.com/LogNet/grpc-spring-boot-starter/issues/250)
- Add metadata to consul service discovery [#249](https://github.com/LogNet/grpc-spring-boot-starter/issues/249)
- Spring security SPEL expressions support (`@PreAuthorize` and `@PostAuthorize`) [#175](https://github.com/LogNet/grpc-spring-boot-starter/issues/175)

## :lady_beetle: Bug Fixes

- Circular bean dependency since 4.5.8 [#253](https://github.com/LogNet/grpc-spring-boot-starter/issues/253)

## :hammer: Dependency Upgrades

- Upgrade spring boot to 2.5.6 [#255](https://github.com/LogNet/grpc-spring-boot-starter/issues/255)

# Version 4.5.8
## :star: New Features

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gradleErrorPronePluginVersion=2.0.2
errorProneVersion=2.7.1
lombokVersion=1.18.20

version=4.5.9-SNAPSHOT
version=4.5.9
group=io.github.lognet
description=Spring Boot starter for Google RPC.
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter
Expand Down
2 changes: 1 addition & 1 deletion grpc-spring-boot-starter-gradle-plugin/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Bootstraps the project with `com.google.protobuf` gradle plugin (including `grp
----
plugins {
id 'java'
id "io.github.lognet.grpc-spring-boot" version '4.5.8'
id "io.github.lognet.grpc-spring-boot" version '4.5.9'
}
----
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 @@ -55,7 +55,7 @@ task generateReleaseNotes(type: JavaExec, group: "documentation") {
)
doFirst {
download {
src 'https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.6/github-changelog-generator.jar'
src 'https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.7/github-changelog-generator.jar'
dest generator
onlyIfModified true
}
Expand Down

0 comments on commit 1ef3709

Please sign in to comment.