Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

SSO: support non-toplevel attribute_requirements #14835

Open
smoehrle opened this issue Jan 13, 2023 · 2 comments
Open

SSO: support non-toplevel attribute_requirements #14835

smoehrle opened this issue Jan 13, 2023 · 2 comments
Labels
A-SSO Single Sign-On (maybe OIDC) O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@smoehrle
Copy link

Description:

To the best of my knowledge, it is only possible to configure and check attribute requirements if the attribute is in the toplevel of the claim/access token.

Example
We use keycloak as OIDC provider. The access token of keycloak contains:

  "resource_access": {
    "{client-id}": {
      "roles": [
        "{client-role-1}",
        "{client-role-2}",
      ]
    }
  },

I want to allow authentication based on a assigned client-role which is nested inside multiple objects.

Possible solution
A solution could be to allow dot-notation for the attribute requiremtes to access nested elements

# homeserver.yaml
    oidc_providers:
    - idp_id: keycloak
      {...}
      attribute_requirements:
        - attribute: resource_access.{client-id}.roles
          value: {client-role-1}
@DMRobertson DMRobertson added A-SSO Single Sign-On (maybe OIDC) T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. labels Jan 16, 2023
@Galbar
Copy link

Galbar commented Aug 16, 2023

I have the same problem with nextcloud, where the groups are at ocs.data.groups. A possible solution would be to allow for a jinja template, like with other attributes.

@Galbar
Copy link

Galbar commented Aug 17, 2023

I managed by setting it like this:

  • enable_registration: false
  • localpart_template: "{% if '{client-role-1}' in user.ocs.data.groups %}{{ user.ocs.data.id }}{% endif %}"

It's not pretty but it does the job 🤷

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-SSO Single Sign-On (maybe OIDC) O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

No branches or pull requests

3 participants