Compare commits

...

2 Commits
0.6.0 ... main

Author SHA1 Message Date
Timo Bejan
48696d0374 Merge branch 'implicitflow' into 'main'
add implicit flow for swagger

See merge request fforesight/swagger-commons!2
2024-03-12 15:10:51 +01:00
Timo Bejan
77a5b81b2c add implicit flow for swagger 2024-03-12 16:06:59 +02:00
2 changed files with 12 additions and 9 deletions

View File

@ -119,16 +119,18 @@ public class SpringDocConfiguration {
private OAuthFlows createOAuthFlows(SpringDocProperties springDocProperties) {
OAuthFlow flow = createAuthorizationCodeFlow(springDocProperties);
return new OAuthFlows().authorizationCode(flow);
}
private OAuthFlow createAuthorizationCodeFlow(SpringDocProperties springDocProperties) {
return new OAuthFlow().authorizationUrl(springDocProperties.getAuthServerUrl() + PROTOCOL_URL_FORMAT + "/auth")
var codeFlow = new OAuthFlow().authorizationUrl(springDocProperties.getAuthServerUrl() + PROTOCOL_URL_FORMAT + "/auth")
.tokenUrl(springDocProperties.getAuthServerUrl() + PROTOCOL_URL_FORMAT + "/token");
var flows = new OAuthFlows().authorizationCode(codeFlow);
if (springDocProperties.isShowImplicitFlow()) {
var implicitFlow = new OAuthFlow().authorizationUrl(springDocProperties.getAuthServerUrl() + PROTOCOL_URL_FORMAT + "/auth")
.tokenUrl(springDocProperties.getAuthServerUrl() + PROTOCOL_URL_FORMAT + "/token");
flows.implicit(implicitFlow);
}
return flows;
}
}

View File

@ -23,6 +23,7 @@ public class SpringDocProperties {
private String title ="Service Open API Documentation";
private String description ="Service Open API Documentation";
private String version = "1.0";
private boolean showImplicitFlow = true;
private List<String> packagesToScan = new ArrayList<>();