Resource Server API Documentation

I had the same problem, looking to do more or less the same thing, this is what I found.

The key for what I was doing was getting a PolicyStore, AdminPermissionManagement and GroupPermissionManagement instance

// Get the realm from the session.
RealmModel realm = session.getContext().getRealm();

// Get the authorization provider and its policy store from the realm.
AuthorizationProvider authorizationProvider = session.getProvider(AuthorizationProvider.class);
PolicyStore policyStore = authorizationProvider.getStoreFactory().getPolicyStore();

// Get the AdminPermissionManagement and GroupPermissionManagement objects for managing
// permissions.
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
GroupPermissionManagement groups =
    AdminPermissions.management(session, session.getContext().getRealm()).groups();

After that I could create a GroupPolicyRepresentation and use that with the PolicyStore to create the policies I needed.

I never found any documentation.

3 Likes