This repository provives an example about how to use WASM to write a policy.
After cloning the repository, you can run the Main application to start the server.
When starting the server for the first time, make sure to create the admin user first as:
- Username:
admin
- Password:
admin
Then re-start the application.
You can also set the KEYCLOAK_ADMIN
and KEYCLOAK_ADMIN_PASSWORD
environment variables to automatically create the admin user.
Open the administration console at http://localhost:8080/admin/master/console/#/myrealm/clients
and then:
- Select the
myclient
client - Click on the
Authorization
tab - Click on the
Evaluate
sub-tab - Select the
alice
users in theUsers
field - Click the
Evaluate
button at the bottom of the page
By doing that, you'll be running the WasmPolicyProvider policy provider.
In the application class, add whatever configuration you want to the policy config map.
If you are starting the application in debug mode from your IDE, you should be able to debug the WasmPolicyProvider policy provider.