Skip to content

Commit

Permalink
Added token to services if it is provided #TASK-5914
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Jan 13, 2025
1 parent aaa9c5a commit 6520c81
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6520c81

Please sign in to comment.