Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

NameID and attributes

An assertion carries two kinds of information about Avery: the NameID that says which account she is, and attributes that describe her. This lesson follows why the first must stay stable while the second can change, how a service asks for the identifier it needs, and why it should receive and trust only the attributes its task needs.

The account behind the name

Six months after joining, Avery marries and changes her surname, and Cedar Inc. updates her display name and her email address, from [email protected] to [email protected]. The next morning she signs in to the training service and finds all her completed courses where she left them. The training service did not match her by name or email. It matched her by the identifier in the assertion's NameID, which did not change.

That identifier is the anchor of the relationship. When the training service first saw Avery, it linked the pair (Cedar Inc.'s entity ID, cedar-training-742) to a local account, and every later sign-in follows that link. Names, addresses and departments can change around it. What kind of identifier the NameID is, and what promises come with it, is set by its format, a URN written in the NameID's Format attribute.

NameID formats

The four NameID formats services most often meet, and what each promises
FormatURNWhat it promises
Persistenturn:oasis:names:tc:SAML:2.0:nameid-format:persistentA stable, opaque identifier made for one identity provider and service provider pair
Transienturn:oasis:names:tc:SAML:2.0:nameid-format:transientA random value for one session only
Email addressurn:oasis:names:tc:SAML:1.1:nameid-format:emailAddressThe value is written as an email address
Unspecifiedurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedNothing; its meaning comes from the agreement

A persistent identifier is pairwise by design, like the pairwise subject identifiers of Public and pairwise subject identifiers. SAML Core, the main SAML specification, requires it to be pseudo-random, with no discernible connection to Avery's username or email, and forbids Cedar Inc. from sharing it with any service provider other than the one it was made for. So the training service knows Avery as cedar-training-742 and the expense service knows her as cedar-expenses-193, and the two cannot compare notes to track her across services. Real values are random strings such as 4f9c2e71-a0b3-4d58-9e16-c2b8f04a7d31; these lessons use short readable stand-ins. The identifier stays the same as long as the relationship lasts, which is exactly what an account link needs. Two attributes on the NameID qualify it: NameQualifier, the identity provider that issued it, and SPNameQualifier, the service provider it was issued for.

Because the identifier is only unique within its pair, the issuer is part of it. Birch Ltd., another company whose staff use the training service, signs its people in through its own identity provider. If Birch Ltd. happened to send the characters cedar-training-742 for one of its employees, that would be a different person. The training service stores the issuer and the NameID together, and looks them up together.

The training service keys each account on the issuer together with a persistent NameID. A changed surname leaves the link alone, the same characters from Birch Ltd. name someone else, and an email address used as the link stops matching when the address changes.

A transient identifier changes every session. It suits services that need no lasting account, such as a library database that only needs to know a sign-in is valid, and it cannot be an account key. An email address format says only how the value is written. It does not say the address was verified, and it does not say the address will stay the same, as Avery's marriage showed. Linking accounts by email-format NameIDs means an address change looks like a new person, and an address reused by a new employee looks like the old one.

Asking for a format

The training service asks for the format it wants in its AuthnRequest, with the NameIDPolicy element that SAML bindings showed inside a request:

xml
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
    AllowCreate="true"/>

AllowCreate="true" permits Cedar Inc. to create a new persistent identifier if Avery has none for the training service yet, which happens on her very first sign-in. With AllowCreate="false", Cedar Inc. may only use an identifier that already exists. SPNameQualifier in the policy can ask for an identifier shared by a group of related services instead of the requester alone.

If Cedar Inc. cannot meet the policy, perhaps because it does not support the format, or because AllowCreate is false and no identifier exists yet, it must not quietly send something else. It returns a response with no assertion and a specific status:

xml
<samlp:Status>
  <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester">
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"/>
  </samlp:StatusCode>
</samlp:Status>

A status code can hold a second, nested status code that narrows it. The outer code, Requester, says the problem lies with the request; the inner code, InvalidNameIDPolicy, says which part. The training service should show Avery a clear error and record the status, not retry with a looser policy behind her back.

Changing format later needs a plan. If the two organizations switch from email identifiers to persistent ones, every existing account is linked to the old values. The training service must map old to new deliberately, for example by having each person sign in once while both values are sent, rather than let the new identifier create a second account or, worse, attach to whichever existing account shares an email address.

Attributes say something different

The NameID says which subject. Attributes, carried in the assertion's AttributeStatement as Reading an assertion showed, say things about the subject. Here are two from Avery's assertion after her name change:

xml
<saml:Attribute Name="urn:oid:0.9.2342.19200300.100.1.3" FriendlyName="mail"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue>[email protected]</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.7" FriendlyName="eduPersonEntitlement"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue>urn:example:training:course-author</saml:AttributeValue>
  <saml:AttributeValue>urn:example:training:learner</saml:AttributeValue>
</saml:Attribute>

Name is the attribute's real name, here an object identifier from a published directory schema, so that two organizations mean the same thing by it. The second one, eduPersonEntitlement, comes from a schema written for universities that many federations reuse to say what a person is entitled to. NameFormat says what kind of name it is: uri for these, or basic for a simple agreed string such as department. FriendlyName is a human-readable label and should not be used for matching. An attribute can carry several values, as the entitlement does.

Attributes change, and they mean only what the agreement says. A department from Cedar Inc.'s HR system is a different kind of fact from a job title Avery typed into her own profile. The training service may display Cedar Inc.'s name for her, but decide course permissions from its own roles, or deliberately map an agreed entitlement value to one of its roles. That mapping is the training service's decision. A signed attribute does not order it to grant anything; a value it does not recognize should grant nothing.

Release and trust only what the task needs

The training service needs Avery's identifier, her name for certificates and her department for assigned courses. It does not need her birth date, home address or full list of groups, so Cedar Inc. does not release them. Every attribute released is data the service provider must protect and may lose, and federation agreements should list the release explicitly.

An assertion is a snapshot from the moment of sign-in. If Avery moves to a new department at lunchtime, the session she started that morning still carries the old one until she signs in again. Services that need current values for sensitive decisions refresh them, or keep sessions short.

Missing values need a planned answer too. If the department is absent, a department-restricted course stays closed, or the service asks for the missing detail through a supported step. An empty or unfamiliar value must never fall through to the most generous default.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The training service receives the persistent NameID cedar-training-742 from Birch Ltd.'s identity provider. It already has an account linked to cedar-training-742 from Cedar Inc. What should it do? 1 of 3

Choose one answer.

The training service sends NameIDPolicy with AllowCreate="false" for someone Cedar Inc. has never issued an identifier for. What should come back? 2 of 3

Choose one answer.

The expense service links accounts by an emailAddress NameID. Avery's address changes to [email protected] after her marriage. What happens at her next sign-in? 3 of 3

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity