Skip to content

Commit 25e2faa

Browse files
committed
Add back in grpc-oauth2 sample
Signed-off-by: onobc <chris.bono@gmail.com>
1 parent abc87c2 commit 25e2faa

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

samples/grpc-oauth2/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.5.5'
4-
id 'io.spring.dependency-management' version '1.1.6'
3+
id 'org.springframework.boot' version '4.0.0-RC1'
4+
id 'io.spring.dependency-management' version '1.1.7'
55
id 'org.graalvm.buildtools.native' version '0.10.3'
66
id 'com.google.protobuf' version '0.9.4'
77
}
@@ -34,12 +34,12 @@ dependencyManagement {
3434
dependencies {
3535
implementation 'org.springframework.grpc:spring-grpc-spring-boot-starter'
3636
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
37-
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
38-
implementation 'org.springframework.boot:spring-boot-starter-security'
39-
implementation 'io.grpc:grpc-services'
40-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
41-
testImplementation 'org.springframework.grpc:spring-grpc-test'
42-
testImplementation 'org.springframework.experimental.boot:spring-boot-testjars-maven:0.0.4'
37+
38+
testImplementation 'org.springframework.grpc:spring-grpc-test-spring-boot-autoconfigure'
39+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
40+
testImplementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
41+
testImplementation 'org.springframework.experimental.boot:spring-boot-testjars-maven:0.4.0.0-SNAPSHOT'
42+
4343
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
4444
}
4545

samples/grpc-oauth2/pom.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>3.5.5</version>
9+
<version>4.0.0-RC1</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,7 +30,7 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.31.1</protobuf-java.version>
33+
<protobuf-java.version>4.32.1</protobuf-java.version>
3434
<grpc.version>1.76.0</grpc.version>
3535
</properties>
3636
<dependencyManagement>
@@ -53,25 +53,26 @@
5353
<groupId>org.springframework.boot</groupId>
5454
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
5555
</dependency>
56+
5657
<dependency>
57-
<groupId>io.grpc</groupId>
58-
<artifactId>grpc-services</artifactId>
58+
<groupId>org.springframework.grpc</groupId>
59+
<artifactId>spring-grpc-test-spring-boot-autoconfigure</artifactId>
60+
<scope>test</scope>
5961
</dependency>
60-
6162
<dependency>
6263
<groupId>org.springframework.boot</groupId>
63-
<artifactId>spring-boot-starter-oauth2-client</artifactId>
64+
<artifactId>spring-boot-starter-test</artifactId>
6465
<scope>test</scope>
6566
</dependency>
6667
<dependency>
67-
<groupId>org.springframework.grpc</groupId>
68-
<artifactId>spring-grpc-test</artifactId>
68+
<groupId>org.springframework.boot</groupId>
69+
<artifactId>spring-boot-starter-oauth2-client</artifactId>
6970
<scope>test</scope>
7071
</dependency>
7172
<dependency>
7273
<groupId>org.springframework.experimental.boot</groupId>
7374
<artifactId>spring-boot-testjars-maven</artifactId>
74-
<version>0.0.4</version>
75+
<version>0.4.0.0-SNAPSHOT</version>
7576
<scope>test</scope>
7677
</dependency>
7778
</dependencies>

samples/grpc-oauth2/src/main/java/org/springframework/grpc/sample/GrpcServerApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@SpringBootApplication
1717
@Import(AuthenticationConfiguration.class)
18-
public class GrpcServerApplication {
18+
class GrpcServerApplication {
1919

2020
public static final Metadata.Key<String> USER_KEY = Metadata.Key.of("X-USER", Metadata.ASCII_STRING_MARSHALLER);
2121

@@ -39,4 +39,4 @@ AuthenticationProcessInterceptor jwtSecurityFilterChain(GrpcSecurity grpc) throw
3939
.build();
4040
}
4141

42-
}
42+
}

samples/grpc-oauth2/src/main/java/org/springframework/grpc/sample/GrpcServerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.grpc.stub.StreamObserver;
1111

1212
@Service
13-
public class GrpcServerService extends SimpleGrpc.SimpleImplBase {
13+
class GrpcServerService extends SimpleGrpc.SimpleImplBase {
1414

1515
private static Log log = LogFactory.getLog(GrpcServerService.class);
1616

@@ -45,4 +45,4 @@ public void streamHello(HelloRequest req, StreamObserver<HelloReply> responseObs
4545
responseObserver.onCompleted();
4646
}
4747

48-
}
48+
}

samples/grpc-oauth2/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.springframework.grpc.sample;
22

3-
import static org.junit.Assert.assertThrows;
43
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertThrows;
55

66
import java.util.concurrent.atomic.AtomicBoolean;
77
import java.util.concurrent.atomic.AtomicReference;
@@ -123,8 +123,8 @@ static class ExtraConfiguration {
123123
static CommonsExecWebServerFactoryBean authServer() {
124124
return CommonsExecWebServerFactoryBean.builder()
125125
.useGenericSpringBootMain()
126-
.classpath(classpath -> classpath.entries(new MavenClasspathEntry(
127-
"org.springframework.boot:spring-boot-starter-oauth2-authorization-server:3.5.5")));
126+
.classpath(classpath -> classpath
127+
.entries(MavenClasspathEntry.springBootStarter("oauth2-authorization-server")));
128128
}
129129

130130
@Bean

samples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<name>Parent Demo</name>
1717

1818
<modules>
19-
<module>grpc-server</module>
2019
<module>grpc-client</module>
21-
<!-- <module>grpc-secure</module>-->
22-
<!-- <module>grpc-oauth2</module>-->
20+
<module>grpc-oauth2</module>
2321
<!-- <module>grpc-reactive</module>-->
22+
<!-- <module>grpc-secure</module>-->
23+
<module>grpc-server</module>
2424
<!-- <module>grpc-server-kotlin</module>-->
2525
<!-- <module>grpc-server-netty-shaded</module>-->
2626
<!-- <module>grpc-tomcat</module>-->

0 commit comments

Comments
 (0)