Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/el-abdel/keycloak-custom-rest-endpoint
Keycloak SPI: Custom REST endpoint that search for users by attribute
https://github.com/el-abdel/keycloak-custom-rest-endpoint
api keycloak rest
Last synced: 19 days ago
JSON representation
Keycloak SPI: Custom REST endpoint that search for users by attribute
- Host: GitHub
- URL: https://github.com/el-abdel/keycloak-custom-rest-endpoint
- Owner: el-abdel
- Created: 2020-12-22T13:50:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-14T11:52:16.000Z (about 3 years ago)
- Last Synced: 2023-03-05T09:46:46.409Z (almost 2 years ago)
- Topics: api, keycloak, rest
- Language: Java
- Homepage:
- Size: 11.7 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Keycloak Custom REST Endpoint
=============================Keycloak custom REST endpoint that search for users by custom user attribute, providing a JWT access token and based on a realm role.
## Keycloak Integration
Build the jar by running mvn install and copy the jar to keycloak's deployment folder.
```
${KEYCLOAK_HOME}/standalone/deployments
```> Keycloak support hot deployment so as soon jar file copied to above location it will create **(jar-name).deployed** file.
> Once application deployed correctly it will be added to keycloak server and visible under `server Info > providers` details.## Testing
1. Create a realm (if you don't have an active one) and add few users with a custom attribute to the realm.
2. Add role `fetch_users` to your realm.
3. Lookup Users
```
curl -i --request GET http://localhost:8080/auth/realms//get-users-by-custom-attr?key=attr_key&value=attr_value --header "Accept: application/json" --header "Authorization: Bearer $ACCESS_TOKEN";
```
> This endpoint is accessible just for authenticated users. REST request must be authenticated with bearer access token of authenticated user and the user must be in realm role `fetch_users` in order to access the resource.