diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/generator/openapi/JsonOpenApiGenerator.java b/opencga-server/src/main/java/org/opencb/opencga/server/generator/openapi/JsonOpenApiGenerator.java index 9308776584..d876e0d41f 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/generator/openapi/JsonOpenApiGenerator.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/generator/openapi/JsonOpenApiGenerator.java @@ -86,11 +86,12 @@ public Swagger generateJsonOpenApi(ApiCommons apiCommons, String token) { javax.ws.rs.Path methodPathAnnotation = wsmethod.getAnnotation(javax.ws.rs.Path.class); String fullPath = basePath + (methodPathAnnotation != null ? methodPathAnnotation.value() : ""); method.setOperationId(methodPathAnnotation != null ? methodPathAnnotation.value() : ""); + List tokens = new ArrayList<>(); if(StringUtils.isEmpty(token)){ - List tokens = new ArrayList<>(); - tokens.add(token); - method.setSecurity(Collections.singletonList(Collections.singletonMap("BearerAuth", tokens))); + tokens.add("Bearer "+token); } + method.setSecurity(Collections.singletonList(Collections.singletonMap("BearerAuth", tokens))); + // Crear o actualizar el Path paths.put(fullPath, new HashMap<>()); paths.get(fullPath).put(httpMethod, method);