OpenID Connect (OIDC)
CILogon provides a standards-compliant OpenID Connect (OAuth 2.0) interface to federated authentication for cyberinfrastructure (CI).
We recommend using a Certified OpenID Connect Implementation when connecting to CILogon. We plan to obtain OpenID Certification for CILogon's OIDC implementation in the future.
To get started, register your client at https://cilogon.org/oauth2/register and wait for notice of approval. Please register your callback URLs on that page with care. They are the only callback URLs that may be used by your client unless you later contact email@example.com and request a change to your registration.
Kubernetes users: It is recommended that you specify a refresh token lifetime of 10 days (864000 seconds) or longer if your cluster requires authentication.
OpenID Connect (OIDC)
CILogon's OpenID Connect (OIDC) endpoint:
CILogon's OAuth 2.0 endpoints:
Please configure your client to request only the scope(s) it requires. CILogon will prompt users to approve release of their information to your client. The less information your client requests (via fewer scopes), the more likely users are to approve. Also note that your client can request AT MOST the scopes that are registered, i.e., the "set intersection" of requested scopes and registered scopes is calculated for the set of returned claims. If you need additional scopes after you have registered your client, please email firstname.lastname@example.org for assistance.
JupyterHub users: If you are using the JupyterHub OAuthenticator plugin with CILogon, please request the following three (3) scopes: openid, email, and org.cilogon.userinfo.
CILogon currently supports the following scopes:
sub - a unique identifier for the user, e.g., "http://cilogon.org/serverA/users/12345"
iss - the issuer of the id_token, e.g., "https://cilogon.org"
aud - the audience of the id_token, which is the client_id of the OIDC client, e.g., "cilogon:/client_id/123456789"
token_id - an identifier for the returned id_token, e.g., "https://cilogon.org/oauth2/idToken/abcdef123456"
potential resulting claim:
email - an email address, e.g., "email@example.com"
potential resulting claims:
given_name - first name, e.g., "John"
family_name - last name, e.g., "Smith"
name - display/full name, e.g., "John A Smith"
org.cilogon.userinfo: CILogon-specific scope, optional
potential resulting claims:
idp - identity provider identifier (a.k.a., entityID) , e.g., "https://idp.example.edu/idp/shibboleth"
idp_name - identity provider display name, e.g., "Example University"
eppn - eduPersonPrincipalName, e.g., "firstname.lastname@example.org"
eptid - eduPersonTargetedID, e.g., "https://idp.example.edu/idp/shibboleth!https://cilogon.org/shibboleth!23aiejfJVIFavDJFaj8bwsHJaxs="
affiliation - group membership, e.g., "email@example.com;firstname.lastname@example.org"
ou - organizational unit, e.g., "Student Senate"
oidc - the "sub" claim as reported by GitHub, Google, and ORCID, e.g., "106198179643554287195" from Google
cert_subject_dn - the subject distinguished name of an X.509 certificate, e.g., "/DC=org/DC=cilogon/C=US/O=Example University/CN=John Smith A12345"
others listed at https://cilogon.org/.well-known/openid-configuration in the claims_supported section
edu.uiuc.ncsa.myproxy.getcert: optional, allows fetching an X.509 certificate from the getcert endpoint
Note that if a user attribute is missing, the corresponding claim will not be asserted, i.e., empty claims are never returned as empty strings. This is the reason for the "potential" qualifier above; your client might request the profile scope, but if the IdP does not assert any names for the user, there will be no given_name, family_name, or name claims.
Optional Authorization Parameters
CILogon's Authorization endpoint (https://cilogon.org/authorize) supports the following optional query parameters:
selected_idp or idphint: A comma-separated list of url-encoded SAML EntityIDs and/or OIDC issuers to be shown to the user in the "Select an Identity Provider" selection list. This parameter complies with AARC-G049 - A specification for IdP hinting and allows a client to specify one or more Identity Providers to be shown to the user. For SAML-based IdPs (e.g., those registered by InCommon and eduGAIN), the entityID value is used. For OIDC-based IdPs (e.g., Google, GitHub, ORCID), the "iss" (issuer) value is used. See https://cilogon.org/idplist/ for the list of SAML-based identity providers supported by CILogon. https://cilogon.org/include/idplist.xml is also available if more details on SAML entities are needed. If multiple IdPs are specified, the first IdP in the list is used as the initially displayed IdP for new visitors. Example showing Google, GitHub, ORCID, and UnitedID: https://cilogon.org?idphint=https%3A%2F%2Faccounts.google.com,https%3A%2F%2Fgithub.com,https%3A%2F%2Forcid.org,https%3A%2F%2Fidp.unitedid.org%2Fidp%2Fshibboleth
initialidp: A url-encoded SAML EntityID or OIDC issuer to be initially selected in the "Select an Identity Provider" selection list. Typically, Google is shown as the default IdP for new users. The "initialidp" parameter allows a client to specify a different IdP to be initially selected. See "idphint" above for the format of the value of this parameter (i.e., entityID for InCommon/eduGAIN IdPs, "iss" (issuer) for OIDC-based IdPs). Notes: (1) The "idphint" parameter takes precedence over "initialidp" since the first IdP in the "idphint" list is used as the default IdP. (2) The "initialidp" parameter only affects new users since a user's previously selected IdP is saved in a browser cookie for future visits. Example showing ORCID as the default IdP: https://cilogon.org?initialidp=https%3A%2F%2Forcid.org
skin: The name of the custom CILogon interface skin for your application. Contact email@example.com to request a custom skin.
User Identifiers and Other Claims
As illustrated in the examples below, CILogon supports standard OpenID Connect claims via the standard openid, email, and profile scopes, in addition to custom claims (eppn, eptid, etc.) via the org.cilogon.userinfo scope. To perform simple authentication, the openid scope is all you need. Quoting the OpenID Connect core specification:
As the specification states, the sub claim is the user identifier that clients should rely on. CILogon provides eppn and eptid claims for applications that need insight into the SAML attributes provided to CILogon, but be aware that not all identity providers support eppn or eptid, whereas CILogon will always provide the sub claim.
CILogon's sub claim is customizable. If the default value doesn't meet your needs, please contact firstname.lastname@example.org for assistance.
CILogon will also include an Authentication Context Class Reference (acr) claim containing the SAML AuthnContextClassRef value provided by the SAML identity provider. For example, to determine if multi-factor authentication was performed, check for an acr value of "https://refeds.org/profile/mfa".
What claims can you expect to receive?
CILogon will always provide the sub (subject) and iss (issuer) claims, but no other claims are guaranteed to be provided. While CILogon will provide requested claims when possible, there are a variety of reasons why CILogon may not be able to provide a requested claim. CILogon clients should be prepared to handle a required claim not being provided, for example by prompting the user for the required information and/or providing a clear error message that specifies what information is needed.
As a REFEDS R&S service, CILogon can usually provide name, email, and affiliation claims when requested. However, not all eduGAIN identity providers supports the REFEDS R&S program, and even those that do may not provide these user attributes for all members of their population (e.g., faculty versus students, full-time versus visiting researchers, FERPA opt-out, etc.).
For More Info
Example using curl
Once you have a registered and approved client, it may be helpful to test/debug using curl on the command-line.
First, set environment variables containing your registered and approved client_id, client_secret, and redirect_uri values. For example:
Be sure to substitute your own client values in the above commands! The CILOGON_CLIENT_SECRET value shown above is not an actual valid client_secret.
Next, visit the Authorization endpoint in your browser. For example:
Be sure to substitute your own client_id and redirect_uri values in the above example! You can experiment with requesting different scope values here. Only the openid scope is required. You must include the edu.uiuc.ncsa.myproxy.getcert scope if you want to retrieve a certificate. Remember that the redirect_uri value must exactly match one of the callback URLs you registered previously with CILogon.
After you successfully authenticate, CILogon will return your browser to the redirect_uri with a code parameter. For example:
Your browser will probably show a "connection refused" error for that localhost location. That's OK. We just need the code parameter from the browser's address bar.
Save the code in an environment variable. For example:
2. Get a Token
Now you're ready for the first curl command, to exchange the code for a token:
In the above example, we use perl to parse the response and store the access token and refresh token values in environment variables. The response (stored in the cilogon-token-response.txt file) will look similar to the following:
We stored the access_token value in the CILOGON_ACCESS_TOKEN environment variable and stored the refresh_token value in the CILOGON_REFRESH_TOKEN environment variable. Note that a refresh_token will only be returned only if refresh tokens are enabled for your client (i.e., you set a refresh token lifetime when you registered your client or you later asked email@example.com to enable refresh tokens for your client).
3. Get UserInfo
Next, you can use the token to get your user information:
The command should produce output similar to the following:
4. Refresh your tokens
If refresh tokens are enabled for your client, then you can used the refresh token to obtain a new access token.
The output stored in the cilogon-token-response.txt file will be similar to before, except it will contain new tokens. Note that refresh tokens may be used only once, so the output contains a new refresh_token that we can use to refresh again later. We store the new tokens in the CILOGON_ACCESS_TOKEN and CILOGON_REFRESH_TOKEN environment variables as before.
5. Get a Certificate
If you requested the edu.uiuc.ncsa.myproxy.getcert scope, you can also use your token to get a certificate. First, generate a private key and certificate request:
Then, submit the certificate request to the GetCert endpoint to retrieve a certificate:
The command should return a certificate in the output. For example:
Example using mod_auth_openidc
mod_auth_openidc is an Apache HTTPD 2.x module which provides client authentication to an OpenID Connect server. It can be used to restrict access to a directory using OpenID Connect authentication. HTTP header variables are populated with OIDC claims which can be used to identify the user.
1. Install mod_auth_openidc - Download the latest version for your operating system from the Releases page. Consult documentation for your O/S on specific installation instructions. Note that other software may be required by mod_auth_openidc for installation. For example, the RPM for CentOS requires libhiredis.so which is provided by the hiredis-devel RPM available from the EPEL repository.
2. Register your client - Use the instructions above to register your client. For this example, assume that the hostname is www.example.org, and we require OpenID Connect authentication to the https://www.example.org/oidc/ directory. Your HTTPD server should be configured for https connections. You can use a self-signed certificate for testing purposes. Note that the Callback URL refers to an empty directory within the /oidc/ directory. This is a requirement of mod_auth_openidc for proper redirection.
After you click the "submit" button, the next page will show you your "client identifier" and "client secret". SAVE THESE VALUES as only you have access to the "client secret". You will need both values in the configuration section below.
3. Configure mod_auth_openidc - In the configuration directory for your Apache HTTPD installation (on CentOS, this is /etc/httpd/conf.d/), create a new file openidc.conf with the following configuration. Enter your "client identifier" and "client secret" you got from the previous step. Also set a passphase of your choosing.
Note that you will need to reload the httpd service configuration after creating this file. On CentOS, this can be accomplished as root with "service httpd reload".
4. Set up the "oidc" directory - In the Apache HTTPD DocumentRoot directory (on CentOS, this is /var/www/html/), create new directorires "oidc" and "oidc/redirect" and a simple file to test your setup. Below is an example PHP script which prints out the HTTP header variables set by the mod_auth_openidc module.
5. Test your setup - Open a web browser, go to https://www.example.org/oidc/index.php , select an identity provider, authenticate with your chosen identity provider, and view the results. Here is example output using Google as the Identity Provider:
The OIDC_CLAIM_sub value is a CILogon-specific identifier that is unique and persistent for the user. Alternatively, REMOTE_USER can be used since (by default) mod_auth_openidc forms this value from OIDC_CLAIM_sub and OIDC_CLAIM_iss as "sub@iss".
6. Handling Errors - In the default configuration, mod_auth_openidc simply prints out the error message and description thrown by OpenID Connect Providers. You can configure mod_auth_openidc to redirect to a different page where you can better handle OIDC errors. Add the following line to your openidc.conf file:
This HTML file can reside anywhere, but must be readable by the Apache httpd process. Then create the HTML file as follows:
Change http://www.example.org/error to a valid location on your server which can handle the submitted form. Note that you will need to reload the httpd service configuration to pick up the new error template file.
Example using OAuth for MyProxy (OA4MP)
Below is a complete sample configuration for an OA4MP OIDC client that talks to the main CILogon server. This assumes this client has been registered and approved. You will get the client id and secret from the server at registration time.
A full explanation of OA4MP configuration files and how they work is here.