0

I have two realms, a public webapp and an extranet where only employees can access. I have tried setting group policies.

When I try to connect with an non-employee user, keycloak still returns the access token.

What did I miss?

EDIT.

I made a mistake, I only have 2 clients.

enter image description here

Yoann Picquenot
  • 640
  • 10
  • 26

1 Answers1

1

You have to limit the access granted to your access token to achieve this. There are three ways to do it (that I know of)

  1. Audience: Allows listing the resource providers that should accept an access token.
  2. Roles: Through controlling what roles a client has access to, it is possible to control what roles an application can access on behalf of the user.
  3. Scope: In Keycloak, scopes are created through client scopes, and an application can only have access to a specific list of scopes.

You can look at this example which explains the flow on how to achieve this using role based method. You can refer this as well.

Abhijeet
  • 4,069
  • 1
  • 22
  • 38