Skip to content

Commit

Permalink
commented some code. need to better understand if we need it or not. …
Browse files Browse the repository at this point in the history
…we probably need to use the access manager.
  • Loading branch information
soimugeo committed Jun 26, 2024
1 parent 8bd8901 commit b43c3fd
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,30 @@ public Class<GetAuthorizedActionsRequest> getRequestClass() {
@Override
public Mono<GetAuthorizedActionsResponse> handleRequest(GetAuthorizedActionsRequest request, ExecutionContext executionContext) {

if(request.resource().isApplication()) {
/*
ToDo: Understand why we need this if else here
*/
// if(request.resource().isApplication()) {
// try {
// List<RoleId> roleIds = tokenValidator.getTokenClaims(executionContext.jwt()).stream()
// .map(RoleId::new)
// .toList();
// Set<ActionId> actions = new HashSet<>(roleOracle.getActionsAssociatedToRoles(roleIds));
// return Mono.just(new GetAuthorizedActionsResponse(request.resource(),
// request.subject(),
// actions));
//
// } catch (VerificationException e) {
// throw new RuntimeException(e);
// }
// }else {
// var actionClosure = accessManager.getActionClosure(request.subject(),
// request.resource());
// return Mono.just(new GetAuthorizedActionsResponse(request.resource(),
// request.subject(),
// actionClosure));
// }

try {
List<RoleId> roleIds = tokenValidator.getTokenClaims(executionContext.jwt()).stream()
.map(RoleId::new)
Expand All @@ -59,12 +82,5 @@ public Mono<GetAuthorizedActionsResponse> handleRequest(GetAuthorizedActionsRequ
} catch (VerificationException e) {
throw new RuntimeException(e);
}
}else {
var actionClosure = accessManager.getActionClosure(request.subject(),
request.resource());
return Mono.just(new GetAuthorizedActionsResponse(request.resource(),
request.subject(),
actionClosure));
}
}
}

0 comments on commit b43c3fd

Please sign in to comment.