Skip to content

Using AAD Group #23

Closed
Closed

Description

@lune94

In a context of a web app I am using this library in order to authenticate my users via Azure Active Directory. I'd like to filter the access to pages according to AAD groups a user belongs to.
Example :
/index accessible only for members from AAD group 'project_users'
/admin accessible only for members from AAD groups 'project_contributor' and 'project_admin'

Does this library allow to do that ?

Regards

Activity

  1. rayluo commented on Apr 23, 2020

    @rayluo
    Contributor

    Navya Canumalla (@navyasric) pointed out that we did not document this scenario in our docs, though a Java sample did that. This Python web app sample does not currently provide such behavior out-of-box.

    Perhaps you can look into the claims of the id token acquired by MSAL, probably with some additional claims, and then use its "groups" claim to decide whether your web app would serve/reject the request.

  2. rayluo commented on May 15, 2020

    @rayluo
    Contributor

    lune94 We do not currently have a Python web app sample for that, but this ".Net web app using groups" sample and this video "Using Security Groups and Application Roles in your apps" will give you a good understanding on the details.

  3. RyanPicco commented on Jul 17, 2020

    @RyanPicco

    lune94 Though I'm not using groups in this exact way, you can define app roles in the manifest

    So after defining the roles you can assign roles to your users (or in your case groups) which are allowed access, then their role will be returned in id_token_claims as "roles", from there you should be able to gate access based on their role value being in a list of acceptable roles, you could write this into a decorator /w args for easy application to each endpoint.

  4. locked and limited conversation to collaborators on Jan 22, 2022
  5. converted this issue into a discussion #74 on Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AnsweredquestionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions