Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {

private static final List<String> WHITE_API_LIST = ImmutableList.of(
"auth/login",
"versions"
"versions",
"openapi.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we add swagger file to white_list by default to allow normal users to check the api & not locked by auth

);

private static String whiteIpStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,30 @@
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import jakarta.ws.rs.ApplicationPath;

@SecurityScheme(
name = "basic",
type = SecuritySchemeType.HTTP,
scheme = "basic"
)
@SecurityScheme(
name = "bearer",
type = SecuritySchemeType.HTTP,
scheme = "bearer"
)
@ApplicationPath("/")
@OpenAPIDefinition(
info = @Info(
title = "HugeGraph RESTful API",
version = CoreVersion.DEFAULT_VERSION,
description = "All management API for HugeGraph",
contact = @Contact(url = "https://github.com/apache/hugegraph", name = "HugeGraph")
)
),
security = {@SecurityRequirement(name = "basic"), @SecurityRequirement(name = "bearer")}
)
public class ApplicationConfig extends ResourceConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ public final class ApiVersion {
* [0.67] Issue-1065: Support dynamically add/remove graph
* [0.68] Issue-1763: Support adamic-adar & resource-allocation API
* [0.69] Issue-1748: Support Cypher query RESTful API
* [0.70] Issue-2242: Optimising adjacency edge queries
* [0.71] PR-2286: Support Arthas API & Metric API prometheus format
*/

/**
* The second parameter of Version.of() is for IDE running without JAR
*/
public static final Version VERSION = Version.of(ApiVersion.class, "0.69");
public static final Version VERSION = Version.of(ApiVersion.class, "0.71");

public static void check() {
// Check version of hugegraph-core. Firstly do check from version 0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ public void testArthasStart() {
public void testArthasApi() {
String body = "{\n" +
" \"action\": \"exec\",\n" +
" \"requestId\": \"req112\",\n" +
" \"consumerId\": \"955dbd1325334a84972b0f3ac19de4f7_2\",\n" +
" \"command\": \"version\",\n" +
" \"execTimeout\": \"10000\"\n" +
" \"command\": \"version\"\n" +
"}";
RestClient arthasApiClient = new RestClient(ARTHAS_API_BASE_URL, false);
// If the request header contains basic auth,
Expand All @@ -52,8 +49,6 @@ public void testArthasApi() {
Response r = arthasApiClient.post(ARTHAS_API_PATH, body);
String result = assertResponseStatus(200, r);
assertJsonContains(result, "state");
assertJsonContains(result, "requestId");
assertJsonContains(result, "sessionId");
assertJsonContains(result, "body");

RestClient arthasApiClientWithAuth = new RestClient(ARTHAS_API_BASE_URL);
Expand Down