Skip to content

Commit

Permalink
Use find by name for resources|policies instead of filtering the list…
Browse files Browse the repository at this point in the history
…. Avoid problems with DEFAULT_MAX_RESULTS = 100 and custom policies

fixes adorsys#1095 adorsys#1090
  • Loading branch information
bohmber committed Jul 12, 2024
1 parent df42b38 commit c8b6a3a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ private String getResourceId(ClientResource clientResource, String resourceName)
// find it with name and owner(clientId) and then with name only
// Note: findByName is not exact filter the resource with the exact name
return clientResource.authorization().resources().findByName(resourceName, clientId).stream()
.filter( r -> resourceName.equals(r.getName()))
.filter(r -> resourceName.equals(r.getName()))
.findFirst().map(ResourceRepresentation::getId)
.orElseGet(
() -> clientResource.authorization().resources()
.findByName(resourceName).stream()
.filter( r -> resourceName.equals(r.getName()))
.filter(r -> resourceName.equals(r.getName()))
.findFirst().map(ResourceRepresentation::getId)
.orElse(null));
}
Expand Down

0 comments on commit c8b6a3a

Please sign in to comment.