You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: refactor user lookup and resource handling with new UserFinder and ResourceFinder classes
streamline code, merged "shared-with" and "shared-by" resource endpoints into the generic endpoint. The latter is technically a breaking change, but since currently nobody uses the library, I will count this as a minor update
Copy file name to clipboardExpand all lines: README.md
+9-25Lines changed: 9 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,15 @@ Returns a list of authorization resource definitions for the client requesting t
69
69
that can be used to filter resources based on their ids.
70
70
71
71
Supported query parameters:
72
-
***ids** - A list of resource ids to search for, in the format `id1,id2`. If provided, the search and attributes parameters CAN NOT be used.
72
+
***ids** - A list of resource ids to search for, in the format `id1,id2`. If provided the filters "name", "owner", "type" and "uri" can not be used. (Exception owner + sharedOnly, this is allowed)
73
+
***name** - Allows for filtering the resources by their name, by default a partial search is done, set 'exactName' for exact matching
74
+
***uri** - Allows filtering the resources by the uri
75
+
***owner** - The uuid of a user will only return resources owned by the user
76
+
***sharedWith** - Allows filtering the resources to all resources shared with the user with the given uuid
77
+
***sharedOnly** - If true, only resources shared with the user will be returned. Enabling this flag MUST be accompanied by the "owner" filter, that is the user id which shared the resources.
78
+
***idsOnly** - If set, only the ids of the resources are returned
79
+
***exactName** - If set only resources that match the name-filter exactly will be returned
80
+
***type** - Allows for filtering for types of resources
73
81
***first** - The first result to return (0-based)
74
82
***max** - The maximum number of results to return (default 100)
@@ -39,7 +38,7 @@ public ApiRoot(RequestHandlerFactory requestHandlerFactory, KeycloakSession sess
39
38
@Path("users")
40
39
@Produces(MediaType.APPLICATION_JSON)
41
40
@NoCache
42
-
publicStream<Map<String, Object>>getUsers(
41
+
publicResponsegetUsers(
43
42
@Parameter(description = "A String contained in username, first or last name, or email. Default search behavior is prefix-based (e.g., foo or foo*). Use *foo* for infix search and \"foo\" for exact search.") @QueryParam("search") Stringsearch,
44
43
@Parameter(description = "A query to search for custom attributes, in the format 'key1:value2 key2:value2'") @QueryParam("attributes") Stringattributes,
45
44
@Parameter(description = "List of comma separated user ids, in the format 'id1,id2'") @QueryParam("ids") Stringids,
@@ -65,34 +64,48 @@ public Stream<Map<String, Object>> getUsers(
65
64
@Path("users/count")
66
65
@Produces(MediaType.TEXT_PLAIN)
67
66
@NoCache
68
-
publicStringgetUsersCount(
67
+
publicResponsegetUsersCount(
69
68
@Parameter(description = "A String contained in username, first or last name, or email. Default search behavior is prefix-based (e.g., foo or foo*). Use *foo* for infix search and \"foo\" for exact search.") @QueryParam("search") Stringsearch,
70
69
@Parameter(description = "A query to search for custom attributes, in the format 'key1:value2 key2:value2'") @QueryParam("attributes") Stringattributes,
71
70
@Parameter(description = "If true, only users with an active session (in any client of the realm) will be counted") @QueryParam("onlineOnly") BooleanonlineOnly
72
71
) {
73
-
returnString.valueOf(
74
-
requestHandlerFactory
75
-
.usersRequestHandler(authenticate())
76
-
.getUserCount(
77
-
search,
78
-
attributes,
79
-
onlineOnly
80
-
)
81
-
);
72
+
returnrequestHandlerFactory
73
+
.usersRequestHandler(authenticate())
74
+
.getUserCount(
75
+
search,
76
+
attributes,
77
+
onlineOnly
78
+
);
82
79
}
83
80
84
81
@GET
85
82
@Path("resources")
86
83
@Produces(MediaType.APPLICATION_JSON)
87
-
publicStream<ResourceRepresentation>getResources(
84
+
publicResponsegetResources(
88
85
@Parameter(description = "List of comma separated resource ids, in the format 'id1,id2'") @QueryParam("ids") Stringids,
86
+
@Parameter(description = "The uuid of a user will return only resources shared with that user") @QueryParam("sharedWith") StringsharedWith,
87
+
@Parameter(description = "Allows for filtering the resources by their name, by default a partial search is done, set 'exactName' for exact matching") @QueryParam("name") Stringname,
88
+
@Parameter(description = "Allows filtering the resources by the uri") @QueryParam("uri") Stringuri,
89
+
@Parameter(description = "The uuid of a user will only return resources owned by the user") @QueryParam("owner") Stringowner,
90
+
@Parameter(description = "If enabled AND the owner is set, only resources shared by the owner will be returned") @QueryParam("sharedOnly") BooleansharedOnly,
91
+
@Parameter(description = "If set, only the ids of the resources are returned") @QueryParam("idsOnly") BooleanidsOnly,
92
+
@Parameter(description = "If set only resources that match the name-filter exactly will be returned") @QueryParam("exactName") BooleanexactName,
93
+
@Parameter(description = "Allows for filtering for types of resources") @QueryParam("type") Stringtype,
0 commit comments