KnowledgeOwl

Auto-Assign Groups By Email Rules (SSO Edition)

You might want to automatically assign reader groups based on a readers' email address. For example, we might want to assign all readers with "@knowledgeowl.com" email addresses to a special Owls Only reader group.

If we're using SSO, we can do this using Custom attribute map rules in Security and access > Access & SSO, in step 3 of the SAML setup, Map reader attributes. OpenID Connect (OIDC) has the same Custom rules in its own Map reader attributes step, so you can follow the same steps there, using claim names instead of IdP attribute names.

Only use this with SSO
There's also an option under Account > Readers > Groups to Auto-Assign Groups By Email Rules. That setting doesn't work with SSO reader accounts. If you're using SSO, follow the instructions below!

Before you begin

Before you can make these changes, you'll need to meet these prerequisites:

  • SSO is set up and working
  • Email address is being passed over 
  • IdP attribute name for the email address field

Create your custom attribute map rule

To set up a Custom attribute map rule to automatically assign readers to groups based on an email address:

  1. Go to Security and access > Access & SSO.
  2. In the Login methods card, select Manage next to SAML.
  3. Expand step 3, Map reader attributes.
  4. Copy the IdP attribute name for Username / email.
    • If you don't have an email address in Username / email, expand step 4, Test login, check Debug mode, select Save changes, and try logging in. Then select Load last login attempt to see the IdP attribute names and values being passed over from your IdP.
  5. Below the attribute map, find Custom rules. If you don't have any rules yet, select Set reader fields with rules to show them. 
  6. Select Add rule. The Create custom map rule modal opens for you to define the rule.
  7. Enter the IdP attribute name that includes the email address.
  8. In the Value matching type section, select Regex pattern.
  9. Copy the code below and paste it into the Regex pattern:
    .*\@knowledgeowl([\.])com
  10. Replace knowledgeowl with your email domain (and com with your domain ending, if it's not a .com!). So, for example, if our email domain was owlmazing.net, we would use:
    .*\@owlmazing([\.])net
  11. Select Reader groups from the Reader attribute dropdown.
  12. In Assign to reader groups, start typing to select the reader group(s) to which you want to assign any SSO readers with matching email addresses.
    The Create custom map rule modal with Regex pattern selected, an email domain pattern entered, and Reader groups selected as the reader attributeSample custom map rule for email domain
  13. Once you've finished adding groups and verified that all information is correct, select Create rule. The rule is saved right away.
  14. Now any readers who log in with matching email addresses should be automatically assigned to the selected reader group(s).