mirror of https://github.com/halo-dev/halo
Fix content api authentication in swagger
parent
74349a11e2
commit
e171344cd1
|
@ -147,18 +147,24 @@ public class SwaggerConfiguration {
|
|||
private List<SecurityContext> contentSecurityContext() {
|
||||
return Collections.singletonList(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.securityReferences(contentApiAuth())
|
||||
.forPaths(PathSelectors.regex("/api/content/.*"))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
AuthorizationScope[] authorizationScopes = {new AuthorizationScope("global", "accessEverything")};
|
||||
AuthorizationScope[] authorizationScopes = {new AuthorizationScope("Admin api", "Access admin api")};
|
||||
return Arrays.asList(new SecurityReference("Token from header", authorizationScopes),
|
||||
new SecurityReference("Token from query", authorizationScopes));
|
||||
}
|
||||
|
||||
private List<SecurityReference> contentApiAuth() {
|
||||
AuthorizationScope[] authorizationScopes = {new AuthorizationScope("content api", "Access content api")};
|
||||
return Arrays.asList(new SecurityReference("Access key from header", authorizationScopes),
|
||||
new SecurityReference("Access key from query", authorizationScopes));
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Halo API Documentation")
|
||||
|
|
Loading…
Reference in New Issue