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

Ability to block logins based on a SAML attribute #8047

Closed
richvdh opened this issue Aug 7, 2020 · 0 comments · Fixed by #8052
Closed

Ability to block logins based on a SAML attribute #8047

richvdh opened this issue Aug 7, 2020 · 0 comments · Fixed by #8052
Assignees

Comments

@richvdh
Copy link
Member

richvdh commented Aug 7, 2020

For some SAML-backed deployments, it is useful to be able to allow or deny login based on the value of a SAML attribute.

For example, consider a system where SAML users are divided into "staff" and "customers". The organisation wishes only staff to have access to the Matrix server. The SAML server might return the following in the SAML assertion:

    <ns0:Attribute FriendlyName="userGroup" Name="https://example.com/userGroup" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
      <ns0:AttributeValue xsi:type="xsd:string">staff</ns0:AttributeValue>
    </ns0:Attribute>

The SAML handler should inspect the userGroup attribute and check that it matches staff. Obviously, the attribute name and value need to be configurable.

I suggest that we implement this in the core SamlHandler rather than the SamlMappingProvider. I'd suggest configuration options like:

attribute requirements:
  - name: userGroup
    value: staff

(which leaves the route open in future to specifying a type of match such as contains or (regex)matches).

@richvdh richvdh self-assigned this Aug 7, 2020
richvdh added a commit that referenced this issue Aug 7, 2020
Hopefully this mostly speaks for itself. I also did a bit of cleaning up of the
error handling.

Fixes #8047
richvdh added a commit that referenced this issue Aug 11, 2020
Hopefully this mostly speaks for itself. I also did a bit of cleaning up of the
error handling.

Fixes #8047
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant