Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
600e805240 | ||
|
0da6a2356f |
1 changed files with 20 additions and 0 deletions
|
@ -13,6 +13,11 @@ import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.Components;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.security.OAuthFlow;
|
||||||
|
import io.swagger.v3.oas.models.security.OAuthFlows;
|
||||||
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||||
import org.apache.catalina.filters.RemoteIpFilter;
|
import org.apache.catalina.filters.RemoteIpFilter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -117,6 +122,21 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
return new RemoteIpFilter();
|
return new RemoteIpFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI cutomOpenApi(){
|
||||||
|
|
||||||
|
return new OpenAPI()
|
||||||
|
.components(new Components()
|
||||||
|
.addSecuritySchemes("oauth2", new SecurityScheme()
|
||||||
|
.type(SecurityScheme.Type.OAUTH2)
|
||||||
|
.scheme("bearer")
|
||||||
|
.in(SecurityScheme.In.HEADER)
|
||||||
|
.bearerFormat("jwt")
|
||||||
|
.flows(new OAuthFlows().password(new OAuthFlow().tokenUrl("/oauth/token")))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AccessTokenConverter accessTokenConverter() {
|
public AccessTokenConverter accessTokenConverter() {
|
||||||
final DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
|
final DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
|
||||||
|
|
Loading…
Reference in a new issue