Scopes

General Concepts

What is a scope?

Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account. An application can request one or more scopes, this information is then presented to the user in the consent screen, and the access token issued to the application will be limited to the scopes granted.

You've probably already seen scopes in action (possibly without knowing that these are scopes) when you logged into to a third party with your Google or Facebook account.

What is a claim?

Claims are statements about an entity (typically, the user) and additional data. If the user gives consent to a scope the authorization server will, depending on the scope, add certain claims directly to the access token, idToken or make it available through the /userinfo endpoint.

Which scope should my application request?

Your application should only request the scopes it really needs to work correctly.

In general applications should request their scopes as late as possible. This way the user will be asked for the permissions he explicitly needs at that moment. For example if your application has the feature of sending notifications to the user by email but the user must enable this feature explicitly, your application does not need to access the End-User's email address before the End-User enables this feature. Therefore the email scope should only be requested, when the End-Users enables this feature.

Data Consistency

In general if a claim is specified as optional it may not be present (and therefore not mapped into the token). Your application needs to be able to handle these cases correctly.

Testing

TODO

Unscoped Claims

There are some claims that are added to every token, they can be found in the token documentation.

Overview

These are all the scopes that are currently available on the SIP Auth Service. Please note that some scopes are categorized as privileged.

ScopeDescriptionConsent requiredPrivileged
addressaccess to the End-User's addresstruetrue
birthdateaccess to the End-User's date of birthtruetrue
emailaccess to the End-User's emailtruefalse
employment-profileaccess to the End-User's relevant information for employment such as AHV numbertruetrue
eth-affiliationaccess to information about the users relationship to ETH Zurich (if any).truefalse
eth-legi-numberaccess to the ETH Legi-Numbertruetrue
eth-study-informationaccess to information about the studies of the End-Usertruetrue
eth-usernameaccess to the nethz uernsame of the End-User (if he is a member of ETH Zurich)truefalse
ibanaccess to the End-User's IBAN numbertruetrue
genderaccess to the End-User's gendertruetrue
home-organizationaccess to the university affiliation of the user.falsefalse
home-organization-uidaccess to the End-User's homeOrganizationUUID (switch field). This should not be used if not required.falsetrue
phoneaccess to the End-User's phone numbertruetrue
profileaccess to general information about the user such as name and profile picture.falsefalse
roles
falsefalse
vseth-profileaccess to information about the End-Users relationship with VSETH and the VSETH student association.truefalse
[web-origins]
falsefalse
  • offline_access
  • web-origins

General Scopes

Address 

The address scope can be requested to access the End-User's address.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
addressJSONEnd-User's preferred postal address. The value of the address member is a JSON RFC4627 structure containing some or all of the members defined in Section 5.1.1 of the OIDC specification.trueuserinfo

NOTE: The End-User's address may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

Example

TODO

Birthdate 

The birthdate scope can be requested to access an End-User's birthdate.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
birthdatestringEnd-User's birthday, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format.trueuserinfo

NOTE: The End-User's birthdate may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

Email 

The email scope can be requested to access an End-User's email.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
emailstringEnd-User's preferred e-mail address. Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. The RP MUST NOT rely upon this value being a unique identifier for a user, since a user may change his email address.falseaccess token, IDToken, userinfo
email_verifiedbooleanTrue if the End-User's e-mail address has been verified; otherwise false. Since VSETH uses SWITCH AAI to authenticate users this value will always be set to true and is only present to work with 3rd party tools which use the value.falseuserinfo

Employment-profile 

COMING SOON

The employment-profile scope can be requested to access the End-User's employment information.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
nationalitystringTODOtrue
stay_permitstringTODOtrue
civil_statusstringTODOtrue
ahv_numberstringTODOtrue

ETH-Affiliation  

COMING SOON

The eth-affiliation scope can be requested to access information about the End-User's relationship with ETH Zurich.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
eth_department_shortstringThe short name of the department according to the ETH Website.trueuserinfo
eth_department_name_destringThe full name of the department in german according to the ETH Websitetrueuserinfo
eth_department_name_enstringThe full name of the department in english according to the ETH Websitetrueuserinfo

ETH-Legi-Number  

COMING SOON

The eth-legi-number scope can be requested to access a End-User's legi number.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
eth_legi_numberstringThe End-User's legi numberfalseuserinfo

NOTE: The End-User's eth_legi_number may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

ETH-Username  

The eth-username scope can be requested to access the End-User's nethz username, if he is a member of ETH Zurich.

claim nametypedescriptionoptionaltoken
eth_usernamestringThe eth username if defined.trueaccess token, id token

NOTE: The End-User's eth_study_programeth_study_program_typeeth_semester may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

ETH-Study-Information 

COMING SOON

The eth-study-information scope can be requested to access the End-User's study information.

claim nametypedescriptionoptionaltoken
eth_study_programstringThe study program (Studiengang) the End-User is currently enrolled in.trueuserinfo
eth_study_program_typestringThe type of the study program, master, bachelor etc.trueuserinfo
eth_semesterintThe semester the End-User is currently enrolled in.trueuserinfo

NOTE: The End-User's eth_study_program, eth_study_program_type, eth_semester may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

IBAN 

COMING SOON

The iban scope can be requested to access an End-User's iban number. The iban number is represented without spaces.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
ibanstringEnd-User's iban.trueuserinfo

Gender 

COMING SOON

The gender scope can be requested to access an End-User's gender.

VSETH uses the ISO/IEC 5218 to represent gender since this is the standard that is used by SWITCH and ETH Zurich. Check out the Switch Website for more information about the usage at SWITCH.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
genderstringEnd-User's gender. The allowed values are: "not known", "female", "male", "not applicable"trueuserinfo
gender_codeintEnd-User's gender as an integer as defined by ISO/IEC 5218.trueuserinfo

home-organization 

COMING SOON

The university-affiliation scope can be requested to access information about the End-User's affiliation to Swiss universities

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
home_organizationstringThe home organization of the End-User as defined by SWITCH siwssEduPersonHomeOrganization. SWITCH also maintains a complete list of home organizations. The list defines the values that can be found in this claim.falseuserinfo
home_organization_typestringThe type of the home organization of the End-User as defined by SWITCH swissEduPersonHomeOrganizationType.falseuserinfo
home_organization_affiliationstringThe affiliation of the End-User to his/her home-organization as defined by the SWITCH eduPersonAffiliation.false

swiss-edu-person-unique-id

The university-affiliation scope can be requested to access the End-User's home organization unique identifier.

If this scope is present the following claims are mapped into the token:


do-not-use

This scope should not be used unless you know what you are doing. Please contact the ISG if you have any questions.


claim nametypedescriptionoptionaltoken
swiss_edu_person_unique_idstringThe home organization unique identifier of the End-User as defined by SWITCH.falseaccess token, id token

Phone

The phone scope can be requested to access an End-User's phone number.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
phone_numberstringEnd-User's phone numbertrueuserinfo
phone_number_verified
Currently not implemented

NOTE: The End-User's phone may not be defined and the claim will be empty for certain user's. The client is responsible for handling this scenario.

Profile  

The profile scope can be requested to access basic information about the End-User such as username and name.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
namestringEnd-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.falseaccess token, ID Token, userinfo
given_namestringGiven name(s) or first name(s) of the End-User. Note that in some cultures, people can have multiple given names; all can be present, with the names being separated by space characters.falseaccess token, userinfo
family_namestringSurname(s) or last name(s) of the End-User. Note that in some cultures, people can have multiple family names or no family name; all can be present, with the names being separated by space characters.falseaccess token, userinfo
nicknamestringCasual name of the End-User that may or may not be the same as the given_name. For instance, a nickname value of Mike might be returned alongside a given_name value of Michael. This value can be set by the End-User. If the value is not defined it defaults to the given_namefalseuserinfo
preferred_usernamestringShorthand name by which the End-User wishes to be referred to at the RP, such as janedoe or j.doe. This value MAY be any valid JSON string including special characters such as @, /, or whitespace. The resource provider MUST NOT rely upon this value being unique.falseaccess token, IDToken, userinfo
profilestringURL of the End-User's profile page.falseIDToken, userinfo
picturestringURL of the End-User's profile picture. This URL MUST refer to an image file (for example, a PNG, JPEG, or GIF image file), rather than to a Web page containing an image. Note that this URL SHOULD specifically reference a profile photo of the End-User suitable for displaying when describing the End-User, rather than an arbitrary photo taken by the End-User. At the moment this claim will contain a link to the Gravatar profile picture of the user for the email address.trueIDToken, userinfo
websitestringURL of the End-User's Web page or blog. This Web page SHOULD contain information published by the End-User or an organization that the End-User is affiliated with.trueuserinfo
updated_atnumberTime the End-User's information was last updated. Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time.falseuserinfo
Not supported yet


zoneinfostringString from zoneinfo [zoneinfo] time zone database representing the End-User's time zone. For example, Europe/Paris or America/Los_Angeles.true
localestringEnd-User's locale, represented as a BCP47 [RFC5646] language tag. This is typically an ISO 639-1 Alpha-2 [ISO639‑1] language code in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1] country code in uppercase, separated by a dash. For example, en-US or fr-CA. As a compatibility note, some implementations have used an underscore as the separator rather than a dash, for example, en_US; Relying Parties MAY choose to accept this locale syntax as well.true

VSETH-Profile  

COMING SOON

The vseth-profile scope can be requested to access basic information about the vseth membership of the End-User.

If this scope is present the following claims are mapped into the token:

claim nametypedescriptionoptionaltoken
vseth_membershipbooleanBoolean indicating whether the End-User is a VSETH member.falseaccess token, id token, userinfo
study_associationstringThe orgID of the student association the End-User is a member of (if any). None if the End-User is not a member of a student association of VSETH.falseaccess token, id token, userinfo
study_association_name_destringThe name of the student association the user belongs to in german.trueuserinfo
study_association_name_enstringThe name of the student association the user belongs to in english.trueuserinfo

API Specific scopes

COMING SOON