Skip to content

Commit 245e906

Browse files
author
Alexander Furer
committed
release 4.2.3
1 parent 0718ff1 commit 245e906

File tree

7 files changed

+11
-41
lines changed

7 files changed

+11
-41
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ Defining bean with type `GrpcSecurityConfigurerAdapter` annotated with `@EnableG
354354
----
355355

356356
This default configuration secures GRPC methods/services annotated with `org.springframework.security.access.annotation.@Secured` annotation. +
357-
The value passed to the Annotation can be left empty in which case only authentication will be performed. +
357+
Leaving value of the annotation empty (`@Secured({})`) means : `authenticate` only, no authorization will be performed. +
358358
If `JwtDecoder` bean exists in your context, it will also register `JwtAuthenticationProvider` to handle the validation of authentication claim.
359359

360360
==== Custom

ReleaseNotes.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
== Version 4.2.3
2+
* gRPC version upgraded to 1.33.1
3+
* Support `authenticate only` when role list is empty , `@Secured({})` (credits to https://github.com/CleverUnderDog[@CleverUnderDog])
4+
15
== Version 4.2.2
26
* Fixes https://github.com/LogNet/grpc-spring-boot-starter/issues/162[162]
37

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
grpcVersion=1.33.0
1+
grpcVersion=1.33.1
22
springBootVersion=2.3.4.RELEASE
33
springCloudVersion=Hoxton.SR6
44

5-
version=4.2.3-SNAPSHOT
5+
version=4.2.3
66
group=io.github.lognet
77
description=Spring Boot starter for Google RPC.
88
gitHubUrl=https\://github.com/LogNet/grpc-spring-boot-starter

grpc-spring-boot-starter-demo/src/main/java/org/lognet/springboot/grpc/demo/GreeterService.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ public void sayAuthHello(Empty request, StreamObserver<GreeterOuterClass.HelloRe
4646
public void sayAuthOnlyHello(Empty request, StreamObserver<GreeterOuterClass.HelloReply> responseObserver) {
4747

4848

49-
final Authentication auth = GrpcSecurity.AUTHENTICATION_CONTEXT_KEY.get();
50-
if(null!=auth) {
51-
String user = auth.getName();
52-
if (auth instanceof JwtAuthenticationToken) {
53-
user = JwtAuthenticationToken.class.cast(auth).getTokenAttributes().get("preferred_username").toString();
54-
}
55-
responseObserver.onNext(GreeterOuterClass.HelloReply.newBuilder().setMessage(user).build());
56-
}else{
57-
responseObserver.onNext(GreeterOuterClass.HelloReply.newBuilder().setMessage("Hello").build());
58-
}
59-
responseObserver.onCompleted();
49+
sayAuthHello(request,responseObserver);
6050
}
6151
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
package io.grpc.examples;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
74
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
95
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
106
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
147
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
168
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
179

1810
/**
1911
*/
2012
@javax.annotation.Generated(
21-
value = "by gRPC proto compiler (version 1.33.0)",
13+
value = "by gRPC proto compiler (version 1.33.1)",
2214
comments = "Source: calculator.proto")
2315
public final class CalculatorGrpc {
2416

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
package io.grpc.examples;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
74
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
95
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
106
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
147
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
168
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
179

1810
/**
@@ -21,7 +13,7 @@
2113
* </pre>
2214
*/
2315
@javax.annotation.Generated(
24-
value = "by gRPC proto compiler (version 1.33.0)",
16+
value = "by gRPC proto compiler (version 1.33.1)",
2517
comments = "Source: greeter.proto")
2618
public final class GreeterGrpc {
2719

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
package io.grpc.examples;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
74
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
95
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
106
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
147
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
168
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
179

1810
/**
1911
*/
2012
@javax.annotation.Generated(
21-
value = "by gRPC proto compiler (version 1.33.0)",
13+
value = "by gRPC proto compiler (version 1.33.1)",
2214
comments = "Source: greeter.proto")
2315
public final class SecuredGreeterGrpc {
2416

0 commit comments

Comments
 (0)