Skip to content

Commit f89ab69

Browse files
committed
Fixed bugs and converged vendor extentions to annotate jakarata @RolesAllowed
1 parent dda01db commit f89ab69

14 files changed

Lines changed: 444 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!target/*-runner
3+
!target/*-runner.jar
4+
!target/lib/*
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.dockerignore
2+
README.md
3+
pom.xml
4+
src/gen/java/org/openapitools/api/AdminApi.java
5+
src/gen/java/org/openapitools/api/AdminOrUserApi.java
6+
src/gen/java/org/openapitools/api/AuthenticatedApi.java
7+
src/gen/java/org/openapitools/api/PublicApi.java
8+
src/main/docker/Dockerfile.jvm
9+
src/main/docker/Dockerfile.native
10+
src/main/resources/META-INF/openapi.yaml
11+
src/main/resources/application.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.23.0-SNAPSHOT
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# JAX-RS server with OpenAPI using Quarkus
2+
3+
## Overview
4+
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an
5+
[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
6+
7+
This is an example of building a OpenAPI-enabled JAX-RS server.
8+
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework and
9+
the [Eclipse-MicroProfile-OpenAPI](https://github.com/eclipse/microprofile-open-api) addition.
10+
11+
The pom file is configured to use [Quarkus](https://quarkus.io/) as application server.
12+
13+
This project produces a jar that defines some interfaces.
14+
The jar can be used in combination with another project providing the implementation.
15+
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.openapitools</groupId>
6+
<artifactId>jaxrs-spec-quarkus-security</artifactId>
7+
<name>jaxrs-spec-quarkus-security</name>
8+
<version>1.0</version>
9+
10+
11+
<properties>
12+
<compiler-plugin.version>3.8.1</compiler-plugin.version>
13+
<maven.compiler.parameters>true</maven.compiler.parameters>
14+
<maven.compiler.source>1.8</maven.compiler.source>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
18+
<quarkus-plugin.version>3.0.1.Final</quarkus-plugin.version>
19+
<quarkus.platform.version>3.0.1.Final</quarkus.platform.version>
20+
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
21+
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
22+
<surefire-plugin.version>2.22.1</surefire-plugin.version>
23+
<jakarta.ws.rs-version>3.1.0</jakarta.ws.rs-version>
24+
<jakarta.annotation-api-version>2.1.1</jakarta.annotation-api-version>
25+
<jackson-databind-nullable-version>0.2.10</jackson-databind-nullable-version>
26+
</properties>
27+
<dependencyManagement>
28+
<dependencies>
29+
<dependency>
30+
<groupId>${quarkus.platform.group-id}</groupId>
31+
<artifactId>${quarkus.platform.artifact-id}</artifactId>
32+
<version>${quarkus.platform.version}</version>
33+
<type>pom</type>
34+
<scope>import</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
38+
<dependencies>
39+
<dependency>
40+
<groupId>io.quarkus</groupId>
41+
<artifactId>quarkus-resteasy</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>io.quarkus</groupId>
45+
<artifactId>quarkus-junit5</artifactId>
46+
<scope>test</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>io.rest-assured</groupId>
50+
<artifactId>rest-assured</artifactId>
51+
<scope>test</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>io.quarkus</groupId>
55+
<artifactId>quarkus-smallrye-openapi</artifactId>
56+
</dependency>
57+
<dependency>
58+
<groupId>io.quarkus.resteasy.reactive</groupId>
59+
<artifactId>resteasy-reactive</artifactId>
60+
</dependency>
61+
<dependency>
62+
<groupId>jakarta.ws.rs</groupId>
63+
<artifactId>jakarta.ws.rs-api</artifactId>
64+
<version>${jakarta.ws.rs-version}</version>
65+
<scope>provided</scope>
66+
</dependency>
67+
<dependency>
68+
<groupId>jakarta.annotation</groupId>
69+
<artifactId>jakarta.annotation-api</artifactId>
70+
<version>${jakarta.annotation-api-version}</version>
71+
</dependency>
72+
<dependency>
73+
<groupId>org.openapitools</groupId>
74+
<artifactId>jackson-databind-nullable</artifactId>
75+
<version>${jackson-databind-nullable-version}</version>
76+
</dependency>
77+
</dependencies>
78+
<build>
79+
<plugins>
80+
<plugin>
81+
<groupId>org.codehaus.mojo</groupId>
82+
<artifactId>build-helper-maven-plugin</artifactId>
83+
<version>1.9.1</version>
84+
<executions>
85+
<execution>
86+
<id>add-source</id>
87+
<phase>generate-sources</phase>
88+
<goals>
89+
<goal>add-source</goal>
90+
</goals>
91+
<configuration>
92+
<sources>
93+
<source>src/gen/java</source>
94+
</sources>
95+
</configuration>
96+
</execution>
97+
</executions>
98+
</plugin>
99+
<plugin>
100+
<groupId>io.quarkus</groupId>
101+
<artifactId>quarkus-maven-plugin</artifactId>
102+
<version>${quarkus-plugin.version}</version>
103+
<executions>
104+
<execution>
105+
<goals>
106+
<goal>build</goal>
107+
</goals>
108+
</execution>
109+
</executions>
110+
</plugin>
111+
<plugin>
112+
<artifactId>maven-compiler-plugin</artifactId>
113+
<version>${compiler-plugin.version}</version>
114+
</plugin>
115+
<plugin>
116+
<artifactId>maven-surefire-plugin</artifactId>
117+
<version>${surefire-plugin.version}</version>
118+
<configuration>
119+
<systemPropertyVariables>
120+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
121+
</systemPropertyVariables>
122+
</configuration>
123+
</plugin>
124+
</plugins>
125+
</build>
126+
<profiles>
127+
<profile>
128+
<id>native</id>
129+
<activation>
130+
<property>
131+
<name>native</name>
132+
</property>
133+
</activation>
134+
<build>
135+
<plugins>
136+
<plugin>
137+
<artifactId>maven-failsafe-plugin</artifactId>
138+
<version>${surefire-plugin.version}</version>
139+
<executions>
140+
<execution>
141+
<goals>
142+
<goal>integration-test</goal>
143+
<goal>verify</goal>
144+
</goals>
145+
<configuration>
146+
<systemPropertyVariables>
147+
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
148+
</systemPropertyVariables>
149+
</configuration>
150+
</execution>
151+
</executions>
152+
</plugin>
153+
</plugins>
154+
</build>
155+
<properties>
156+
<quarkus.package.type>native</quarkus.package.type>
157+
</properties>
158+
</profile>
159+
</profiles>
160+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.openapitools.api;
2+
3+
4+
import jakarta.ws.rs.*;
5+
import jakarta.ws.rs.core.Response;
6+
import org.jboss.resteasy.reactive.ResponseStatus;
7+
8+
9+
10+
import java.io.InputStream;
11+
import java.util.Map;
12+
import java.util.List;
13+
import jakarta.validation.constraints.*;
14+
import jakarta.validation.Valid;
15+
16+
17+
@Path("/admin")
18+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.23.0-SNAPSHOT")
19+
public interface AdminApi {
20+
21+
@GET
22+
@ResponseStatus(200)
23+
@jakarta.annotation.security.RolesAllowed({"admin"})
24+
void getAdmin();
25+
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.openapitools.api;
2+
3+
4+
import jakarta.ws.rs.*;
5+
import jakarta.ws.rs.core.Response;
6+
import org.jboss.resteasy.reactive.ResponseStatus;
7+
8+
9+
10+
import java.io.InputStream;
11+
import java.util.Map;
12+
import java.util.List;
13+
import jakarta.validation.constraints.*;
14+
import jakarta.validation.Valid;
15+
16+
17+
@Path("/admin-or-user")
18+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.23.0-SNAPSHOT")
19+
public interface AdminOrUserApi {
20+
21+
@GET
22+
@ResponseStatus(200)
23+
@jakarta.annotation.security.RolesAllowed({"admin","user"})
24+
void getAdminOrUser();
25+
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.openapitools.api;
2+
3+
4+
import jakarta.ws.rs.*;
5+
import jakarta.ws.rs.core.Response;
6+
import org.jboss.resteasy.reactive.ResponseStatus;
7+
8+
9+
10+
import java.io.InputStream;
11+
import java.util.Map;
12+
import java.util.List;
13+
import jakarta.validation.constraints.*;
14+
import jakarta.validation.Valid;
15+
16+
17+
@Path("/authenticated")
18+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.23.0-SNAPSHOT")
19+
public interface AuthenticatedApi {
20+
21+
@GET
22+
@ResponseStatus(200)
23+
@jakarta.annotation.security.RolesAllowed({"**"})
24+
void getAuthenticated();
25+
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.openapitools.api;
2+
3+
4+
import jakarta.ws.rs.*;
5+
import jakarta.ws.rs.core.Response;
6+
import org.jboss.resteasy.reactive.ResponseStatus;
7+
8+
9+
10+
import java.io.InputStream;
11+
import java.util.Map;
12+
import java.util.List;
13+
import jakarta.validation.constraints.*;
14+
import jakarta.validation.Valid;
15+
16+
17+
@Path("/public")
18+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.23.0-SNAPSHOT")
19+
public interface PublicApi {
20+
21+
@GET
22+
@ResponseStatus(200)
23+
void getPublic();
24+
25+
}

0 commit comments

Comments
 (0)