'keycloak to secure multiple web application

I am using keycloak as an authentication service for my web application. I have 2 applications installed as follows.

  1. https://example.com. => app1
  2. https://example.com/new. => app2

I want to restrict users to the application like user1 should only be allowed for app1 and user2 should only be allowed for app2.

I have created 2 resources (Authorization -> Resources) and created a user-based policy for each Resource but still, all users can log in to all applications.

I even tried 2 user policy for one Resource

  1. One will explicitly deny a user to the Resource 2, One will explicitly allow a user to the same Resource

But still, nothing is worked. Can someone please help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source