192 Map<String, String[]> search =
new HashMap<>();
194 if (
id != null && !
"".equals(
id.trim())) {
195 search.put(
"id",
new String[] {
id});
198 if (name != null && !
"".equals(name.trim())) {
199 search.put(
"name",
new String[] {name});
202 if (type != null && !
"".equals(type.trim())) {
203 search.put(
"type",
new String[] {type});
206 if (owner != null && !
"".equals(owner.trim())) {
207 search.put(
"owner",
new String[] {owner});
212 if (resource != null && !
"".equals(resource.trim())) {
216 if (resourceModel == null) {
217 Map<String, String[]> resourceFilters =
new HashMap<>();
219 resourceFilters.put(
"name",
new String[]{resource});
222 resourceFilters.put(
"owner",
new String[]{owner});
227 if (resources.isEmpty()) {
228 return Response.ok().build();
231 search.put(
"resource", resources.toArray(
new String[resources.size()]));
233 search.put(
"resource",
new String[] {resourceModel.getId()});
237 if (scope != null && !
"".equals(scope.trim())) {
238 ScopeStore scopeStore = storeFactory.getScopeStore();
241 if (scopeModel == null) {
242 Map<String, String[]> scopeFilters =
new HashMap<>();
244 scopeFilters.put(
"name",
new String[]{scope});
246 Set<String> scopes = scopeStore.findByResourceServer(scopeFilters,
resourceServer.
getId(), -1, 1).stream().map(
Scope::getId).collect(Collectors.toSet());
248 if (scopes.isEmpty()) {
249 return Response.ok().build();
252 search.put(
"scope", scopes.toArray(
new String[scopes.size()]));
254 search.put(
"scope",
new String[] {scopeModel.getId()});
258 if (permission != null) {
259 search.put(
"permission",
new String[] {permission.toString()});
263 doSearch(firstResult, maxResult, search))
void requireViewAuthorization()
RealmPermissionEvaluator realm()
StoreFactory getStoreFactory()
Definition: AuthorizationProvider.java:109
List< Object > doSearch(Integer firstResult, Integer maxResult, Map< String, String[]> filters)
Definition: PolicyService.java:271
final AdminPermissionEvaluator auth
Definition: PolicyService.java:79
final AuthorizationProvider authorization
Definition: PolicyService.java:78
Resource findById(String id, String resourceServerId)
final ResourceServer resourceServer
Definition: PolicyService.java:77
ResourceStore getResourceStore()