How to use azure groups as symfony security roles

74 Views Asked by At

Given roles hierarchy defined in security.yml which is used to grant access in our application:

role_hierarchy:
  ROLE_COMMERCIAL: [ ROLE_USER ]
  ROLE_MANAGER: [ ROLE_USER ]
  ROLE_COMMERCIAL_ADMIN: [ ROLE_COMMERCIAL ]
  ROLE_MANAGER_ADMIN: [ ROLE_MANAGER ]
  ROLE_ADMIN: [ ROLE_COMMERCIAL_ADMIN, ROLE_MANAGER_ADMIN ]
  ROLE_SUPER_ADMIN: [ ROLE_ADMIN ]
 

Now, in azure account, we create some groups and attachs user to their groups. Example of azure groups:

  APP_COMMERCIAL
  APP_MANAGER
  APP_COMMERCIAL_ADMIN
  APP_MANAGER_ADMIN
  APP_ADMIN
  APP_SUPER_ADMIN

Now when we connect via azure account using knpuniversity/oauth2-client-bundle and thenetworg/oauth2-azure, how to rely on azure authenticated user groups and map them to security roles in symfony?

0

There are 0 best solutions below