Organizations
An organization is a customer inside a tenant.
- Its members are accounts.
- Each member holds one role in the organization.
- Every organization has the roles
ownerandmember. It can offer more, such asbilling. - An account can belong to several organizations, or to none.
| Who | Where | Can |
|---|---|---|
| A manager | /manage, under Organizations |
Add and archive organizations. Set their sign-in. Add, promote, and remove anyone. |
| An owner | Their own account page, under Organizations | Invite, promote, and remove the members of their own organization. |
| A member | Their own account page | See their role. Accept or decline an invitation. Leave. |
In /manage, each change needs one of the manage roles:
masks:manage:securityto add, archive, or restore an organization, or to change its roles or sign-in.masks:manage:supportto add members, invite them again, change their role, or remove them.
Adding an organization
Section titled “Adding an organization”- In
/manage, open Organizations and choose Add organization. - Enter a name. masks fills in the key from the name. Apps ask for the organization by its key, such
as
organization=acme. A key uses lowercase letters, digits, and dashes. - Choose Add organization again to save it. You become its first owner.
- Add the customer’s own owner as a member in the
ownerrole. - Once they accept, remove yourself if you want to.
A role is a word that the member’s tokens carry.
- To add a role, open the organization’s Roles tab, enter it under Offer another role, and choose Add.
- A role uses lowercase letters, digits, dashes, and underscores. It is up to 40 characters long.
ownerandmemberare always offered.- A role cannot be removed while someone holds it.
Inviting members
Section titled “Inviting members”Adding someone to an organization invites them. Until they accept, the invitation gives them nothing:
- no
orgclaim in their tokens - no place in the list of organizations to choose from
- nothing for the organization’s directory to change
To invite someone from /manage:
- Open the organization and choose Add member.
- Enter the person’s email address.
- Choose a role.
- Choose Invite.
An owner invites someone from Organizations on their own account page. They enter the address
under Add someone by email, choose a role, and choose Add. An owner needs no /manage
access, and reaches only the organizations they own.
masks emails the person. The email names the organization, the role, and who invited them.
| The address belongs to | The email |
|---|---|
| An account with a confirmed address | Links to the invitation on their account page. They accept or decline it there. |
| No account | An account invitation to choose a password. Once they have an account, the organization is waiting on their account page. |
| An account with no confirmed address | Nothing is sent. The invitation waits on their account page. |
When neither the tenant nor the server has a way to send mail, /manage shows the account
invitation’s link so the manager can send it. The link works once.
Who an owner can invite
Section titled “Who an owner can invite”A manager can invite any address. An owner can invite an address in these cases:
- The address is at a domain proven for one of the organization’s providers.
- The organization’s sign-in policy admits the address, and that policy allows signup.
Some details about this rule:
- The organization’s sign-in policy is its own policy when it has one. Otherwise it is the tenant’s policy.
- The rule does not depend on whether an account holds the address. So the answer does not reveal who has an account.
- An owner sends at most 50 invitations a day. Invitations sent again count toward this limit.
- A new account made by an invitation gets the policy’s signup scopes.
Accepting
Section titled “Accepting”Only an account that holds the address, confirmed, can accept an invitation sent to that address.
- The invitation waits on their account page, under Waiting for you. It shows who sent it, the role, when it expires, and the address it went to.
- An account whose address is not confirmed is asked to confirm it under Email address first.
- An invitation sent to another address says where it went. The person signs in with that address. Or they ask an owner to invite the address on this account.
- Signing in through the organization’s own provider accepts a waiting invitation without these checks.
Declining removes the invitation. An owner has to invite the person again.
Sending an invitation again
Section titled “Sending an invitation again”An organization invitation expires two weeks after it was last sent. An owner changes this under
Links in /manage. See Link lifetimes.
- Open the organization’s members, in
/manageor on an owner’s account page. - Find the person. An open invitation is marked invited. An expired one is marked expired.
- Choose Send again.
Sending again does three things:
- emails the person
- starts the lifetime over
- records Organization invitation sent again
An invitation can be sent again at most once an hour.
An expired invitation cannot be accepted. The nightly sweep removes it and records Organization invitation expired. The sweep waits until the invitation has been expired for as long as it was open. By default, that is four weeks after it was last sent.
Changing roles and removing members
Section titled “Changing roles and removing members”| Change | What happens |
|---|---|
| A member’s role changes | Their access tokens for the organization are revoked. The app’s next refresh carries the new role. |
| A member is removed | Every token issued for them in the organization is revoked, refresh tokens included. |
| An invitation is withdrawn | It is removed. Nothing had been granted. |
| A member leaves | The same as being removed. An owner has to invite them again. |
An organization always keeps an owner.
- The only owner cannot leave, step down, or be removed until someone else is an owner.
- Two owners cannot remove each other at the same time.
- When the last owner’s account is deleted, masks records Organization left without an owner. Only managers can change its members until they make someone an owner.
An app that receives shared signals, and holds a token for the organization, hears about role changes and removals as they happen.
What members are told
Section titled “What members are told”masks emails a member when someone else changes their place in an organization.
| Sent when | |
|---|---|
| Role changed | Their role changes. The email names the old role and the new one. |
| Removed | They are removed from the organization. |
| Archived | The organization is archived while they are signed in to an app for it. |
- A member who makes the change themselves, such as by leaving, gets no email.
- These emails go only to a confirmed address.
- Each person can turn them off on the account page, under Emails we send you, in the Organizations group. See security emails.
Signing in as a member
Section titled “Signing in as a member”An app asks for the organization scope. Its tokens then carry an org claim for one organization.
A claim is a named value inside a token.
{ "org": { "id": "5f0c…", "key": "acme", "name": "Acme", "role": "billing" } }| The person | What happens |
|---|---|
| Belongs to one organization | masks uses that one, without a question. |
| Belongs to several | masks asks which one, after they sign in. |
| Belongs to none | The app gets access_denied. |
Naming the organization
Section titled “Naming the organization”- An app that already knows the organization passes
organization=acmeon/authorize. This skips the question. - A person who is not a member of that organization gets
access_denied. - An app can name an organization without asking for the scope. The sign-in is then still limited to its members and still follows its sign-in policy.
Switching and refreshing
Section titled “Switching and refreshing”- To switch organizations, the app sends the person through
/authorizeagain with another key. The session carries over. A person already signed in the way the organization requires is not asked for a password. - A refresh reads the member’s role again.
- A refresh for someone who is no longer a member is refused with
invalid_grant.
Device sign-in
Section titled “Device sign-in”A device sign-in can name the organization with organization
on /device_authorization. Or the person chooses one when they approve it.
- Its tokens carry that organization.
- Redeeming the device code is refused once the membership has ended.
An organization’s own sign-in
Section titled “An organization’s own sign-in”An organization can have its own sign-in policy, provider, and directory. Set all three on the
organization’s Sign-in tab in /manage.
Policy
Section titled “Policy”A member signs in under the organization’s policy first, ahead of the app’s policy and the tenant’s. The policy applies once masks knows the organization. That happens after the first factor, when masks takes the organization the app named or the person chooses one.
When the app names the organization on /authorize, the first step can already offer the
organization’s own providers.
Once the policy applies:
- A person may have signed in with a first factor the policy does not list, or through a provider it does not offer. They see That organization asks you to sign in another way. They sign in again with a first factor the policy accepts.
- A person whose address is outside the policy’s
email_domainsis refused withaccess_denied. - The second factor, session lifetime, and step-up follow the policy.
Provider
Section titled “Provider”A provider handed to an organization is offered only to a request that names the organization. Everyone who signs in through it becomes a member, in the role their groups map to.
- The provider reads groups from the
groupsclaim, or from another claim it names. - The first mapped group a person holds decides the role.
- A person in no mapped group gets the unmapped role. This is
memberunless you set another. - The role is set again on every sign-in.
- Sometimes the provider would take away the last owner’s role. Then masks records Organization role kept against the provider, and the role stays.
- An invited account that has no password yet is linked only when masks trusts the address from the provider. Otherwise the sign-in is refused, and the invitation stays waiting.
- An existing account with the same address is linked only after that account signs in another way once. This is the same as with any provider.
Directory
Section titled “Directory”A provisioning token for one organization reaches only that organization’s members. It manages their roles through SCIM groups. See a directory for one organization.
What apps read
Section titled “What apps read”| Where | org |
orgs |
|---|---|---|
| ID token, access token | The organization signed in to. The role held when the token was issued. | |
| Userinfo | The organization the token was issued for. The role held now. | Every organization the person has joined. The role held in each. |
| Introspection | The organization the token was issued for. The role held now. |
orgappears when the token names an organization.orgsappears when the token holds theorganizationscope.- Each entry in
orgshas the sameid,key,name, androleasorg. orgslists only joined organizations. It leaves out open invitations and archived organizations.- Discovery lists both claims in
claims_supported.
{ "sub": "8f4c…", "org": { "id": "5f0c…", "key": "acme", "name": "Acme", "role": "billing" }, "orgs": [ { "id": "5f0c…", "key": "acme", "name": "Acme", "role": "billing" }, { "id": "a21e…", "key": "globex", "name": "Globex", "role": "owner" } ]}In a Rails app
Section titled “In a Rails app”Masks::Rails reads both claims. It limits pages and APIs to members in a role. See
organizations in a Rails app.
In a single-page app
Section titled “In a single-page app”In @masks/client, an account carries organization and organizations. holdsRole checks the
role, and switchOrganization sends the person through sign-in again, naming another organization.
The Actor components for React and Svelte list the other organizations when given
onSwitchOrganization. See @masks/client.
Organizations in /manage
Section titled “Organizations in /manage”An organization with no owner is marked no owner, on the overview and under Organizations.
An organization’s page counts its members, owners, open invitations, and live tokens. It opens on Members.
| Tab | Holds |
|---|---|
| Members | Everyone, Owners, or Invited, which includes expired invitations. Each person’s role. Send again, and removal. |
| Sign-in | The sign-in policy. The organization’s providers and their group mapping. Its domains, and whether each is proven. Any provisioning token for it. |
| Roles | The roles it offers. How many members hold each. |
| Activity | Changes to the organization. What happened while someone signed in as a member. |
| General | Its name, key, and ID. The organization= value apps ask for it with. Archiving it, with how many live tokens that revokes. |
Archiving an organization does two things:
- revokes every token issued for it
- stops it from being offered
Members keep their roles, so Restore puts everything back.
An organization’s activity
Section titled “An organization’s activity”An event belongs to an organization in these cases:
- It is about the organization or its members.
- It happens while someone signs in to an app as a member, such as consent or a refused sign-in.
- It is a refresh or exchange of a token issued for the organization. The token carries the organization along.
The organization’s Activity tab lists its recent events. An event stream can send only those events.