mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Add swagger
This commit is contained in:
@@ -10,6 +10,7 @@ A Spring Boot overlay server for Twitch broadcasters and their channel admins. B
|
|||||||
- In-memory channel directory optimized with lock-free collections for fast updates.
|
- In-memory channel directory optimized with lock-free collections for fast updates.
|
||||||
- Optional SSL with local self-signed keystore support.
|
- Optional SSL with local self-signed keystore support.
|
||||||
- Dockerfile, Makefile, CI workflow, and Maven build.
|
- Dockerfile, Makefile, CI workflow, and Maven build.
|
||||||
|
- OpenAPI/Swagger UI docs available at `/swagger-ui.html`.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -98,6 +98,12 @@
|
|||||||
<version>2.3.4</version>
|
<version>2.3.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
19
src/main/java/com/imgfloat/app/config/OpenApiConfig.java
Normal file
19
src/main/java/com/imgfloat/app/config/OpenApiConfig.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.imgfloat.app.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class OpenApiConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI imgfloatOpenAPI() {
|
||||||
|
return new OpenAPI()
|
||||||
|
.info(new Info()
|
||||||
|
.title("Imgfloat API")
|
||||||
|
.description("OpenAPI documentation for Imgfloat admin and broadcaster APIs.")
|
||||||
|
.version("v1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,16 @@ public class SecurityConfig {
|
|||||||
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||||
http
|
http
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers("/", "/css/**", "/js/**", "/webjars/**", "/actuator/health").permitAll()
|
.requestMatchers(
|
||||||
|
"/",
|
||||||
|
"/css/**",
|
||||||
|
"/js/**",
|
||||||
|
"/webjars/**",
|
||||||
|
"/actuator/health",
|
||||||
|
"/v3/api-docs/**",
|
||||||
|
"/swagger-ui.html",
|
||||||
|
"/swagger-ui/**"
|
||||||
|
).permitAll()
|
||||||
.requestMatchers("/ws/**").permitAll()
|
.requestMatchers("/ws/**").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user