Author | SHA1 | Message | Date |
---|---|---|---|
|
29b5aa380e | add jwt config for swagger | 8 months ago |
|
eacc0c8f90 | add swagger config | 8 months ago |
@@ -57,7 +57,8 @@ dependencies { | |||||
implementation group: 'com.squareup.moshi', name: 'moshi-adapters', version: '1.15.1' | implementation group: 'com.squareup.moshi', name: 'moshi-adapters', version: '1.15.1' | ||||
implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.32' | implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.32' | ||||
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0' | |||||
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '6.0.0' | ||||
runtimeOnly 'com.mysql:mysql-connector-j' | runtimeOnly 'com.mysql:mysql-connector-j' | ||||
@@ -0,0 +1,20 @@ | |||||
package com.ffii.tsms.config; | |||||
import org.springframework.context.annotation.Configuration; | |||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition; | |||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; | |||||
import io.swagger.v3.oas.annotations.info.Info; | |||||
import io.swagger.v3.oas.annotations.security.SecurityScheme; | |||||
@Configuration | |||||
@OpenAPIDefinition(info = @Info(title = "My API", version = "v1")) | |||||
@SecurityScheme( | |||||
name = "bearerAuth", | |||||
type = SecuritySchemeType.HTTP, | |||||
bearerFormat = "JWT", | |||||
scheme = "bearer" | |||||
) | |||||
public class OpenApi30Config { | |||||
} |
@@ -33,12 +33,16 @@ public class SecurityConfig { | |||||
public static final String LDAP_LOGIN_URL = "/ldap-login"; | public static final String LDAP_LOGIN_URL = "/ldap-login"; | ||||
public static final String INVOICE = "/invoices/pdf"; | public static final String INVOICE = "/invoices/pdf"; | ||||
public static final String SWAGGER_URL = "/v3/api-docs/**"; | |||||
public static final String SWAGGER_INDEX_URL = "/swagger-ui/**"; | |||||
public static final String[] URL_WHITELIST = { | public static final String[] URL_WHITELIST = { | ||||
INDEX_URL, | INDEX_URL, | ||||
LOGIN_URL, | LOGIN_URL, | ||||
LDAP_LOGIN_URL, | LDAP_LOGIN_URL, | ||||
INVOICE, | INVOICE, | ||||
SWAGGER_URL, | |||||
SWAGGER_INDEX_URL | |||||
}; | }; | ||||
@Lazy | @Lazy | ||||