|
| 1 | +# OIDC Integration Using CILogon |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +[CILogon](https://www.cilogon.org) provides a standards-compliant OpenID |
| 6 | +Connect (OAuth 2.0) interface to federated authentication for |
| 7 | +cyberinfrastructure (CI). CILogon's federated identity management enables |
| 8 | +researchers to use their home organization credentials to access |
| 9 | +applications, rather than requiring yet another username and password to |
| 10 | +log on. |
| 11 | + |
| 12 | +CILogon is operated by the |
| 13 | +[National Center for Supercomputing Applications (NCSA)](https://www.ncsa.illinois.edu/) |
| 14 | +at the [University of Illinois at Urbana-Champaign](https://illinois.edu/). |
| 15 | + |
| 16 | +## Prequisites |
| 17 | + |
| 18 | +You should have already successfully deployed and configured the |
| 19 | +chat service (Open WebUI) using the standard login form authentication. |
| 20 | +This guide only details additional configuration needed for OIDC integration |
| 21 | +using CILogon and does not address overall configuration issues. |
| 22 | + |
| 23 | +The [OIDC protocol](https://openid.net/specs/openid-connect-core-1_0.html) |
| 24 | +requires web applications to be served using HTTPS. Your service should |
| 25 | +already be |
| 26 | +[configured to use HTTPS](link-to-traefix-documentation). |
| 27 | +The only exception to this requirement is during exploration or development |
| 28 | +when `http://localhost` or `http://127.0.0.1` may be used. |
| 29 | + |
| 30 | +## Request Your CILogon Client ID and Secret |
| 31 | + |
| 32 | +CILogon subscribers may log into their CILogon Registry service and use |
| 33 | +the self-service interface to request a client ID and secret. |
| 34 | + |
| 35 | +Basic Authentication service tier (free) users should request a client |
| 36 | +following the instructions below and wait for a notice of approval. |
| 37 | + |
| 38 | +1. Browse to the |
| 39 | +[CILogon OpenID Connect (OIDC) Client Registration](https://cilogon.org/oauth2/register) |
| 40 | +form. |
| 41 | + |
| 42 | +1. Complete the form fields for Client Name, Contact Email, and Home URL. |
| 43 | + |
| 44 | +1. For the Callback URLs field enter `https://<YOUR SERVER>/oauth/oidc/callback` |
| 45 | + and repalce `<YOUR SERVER>` with the hostname or service name for your |
| 46 | + deployment. |
| 47 | + |
| 48 | +1. For Scopes tick the boxes for email, openid, and profile. |
| 49 | + |
| 50 | +1. Click `Register Client`. |
| 51 | + |
| 52 | +1. Record the client ID and secret. You must safely escrow the client secret |
| 53 | + since CILogon does not store it and only stores a computed hash of the |
| 54 | + secret. |
| 55 | + |
| 56 | +1. Wait for an email indicating your client has been approved. You cannot |
| 57 | + successfully test your configuration until the client has been approved. |
| 58 | + |
| 59 | +## Configuration |
| 60 | + |
| 61 | +The OAuth or OIDC integration for Open WebUI may be completely configured |
| 62 | +using environment variables. For additional details beyond those below |
| 63 | +see the following Open WebUI documentation: |
| 64 | + |
| 65 | +- [Environment Variable Configuration](https://docs.openwebui.com/getting-started/env-configuration) |
| 66 | +- [SSO(OAuth, OIDC, Trusted Header)](https://docs.openwebui.com/features/auth/sso/) |
| 67 | +- [Troubleshooting OAUTH/SSO Issues](https://docs.openwebui.com/troubleshooting/sso/) |
| 68 | + |
| 69 | + |
| 70 | +Edit the `llm_chat_ui.environment` section of the `docker-compose.yml` file |
| 71 | +as follows: |
| 72 | + |
| 73 | +1. |
| 74 | + ``` |
| 75 | + ENABLE_OAUTH_PERSISTENT_CONFIG: "False" |
| 76 | + ``` |
| 77 | + |
| 78 | + This forces the OAuth configuration to always be read from environment |
| 79 | + variables on every restart. |
| 80 | + |
| 81 | +1. |
| 82 | + ``` |
| 83 | + ENABLE_SIGNUP: "True" |
| 84 | + ``` |
| 85 | + |
| 86 | + Enable user account creation generally. See also `ENABLE_OAUTH_SIGNUP`. |
| 87 | + |
| 88 | +1. |
| 89 | + ``` |
| 90 | + ENABLE_OAUTH_SIGNUP: "True" |
| 91 | + ``` |
| 92 | + |
| 93 | + Enable user account creation when authenticating using OAuth. |
| 94 | + |
| 95 | +1. |
| 96 | + ``` |
| 97 | + WEBUI_URL: "https://<YOUR SERVER>" |
| 98 | + ``` |
| 99 | + |
| 100 | + Replace `<YOUR SERVER>` with the hostname from which your service will |
| 101 | + be served. Open WebUI uses this configuration to construct the appropriate |
| 102 | + return URI used during the OAuth or OIDC authentication flow. |
| 103 | + |
| 104 | +1. |
| 105 | + ``` |
| 106 | + OAUTH_CLIENT_ID: "<YOUR CLIENT ID FROM CILOGON>" |
| 107 | + ``` |
| 108 | + |
| 109 | + Replace `<YOUR CLIENT ID FROM CILOGON>` with the client ID obtained when |
| 110 | + you requested your client from CILogon. The client ID will usually follow |
| 111 | + the format |
| 112 | + |
| 113 | + ``` |
| 114 | + cilogon:/client_id/... |
| 115 | + ``` |
| 116 | + |
| 117 | +1. |
| 118 | + ``` |
| 119 | + OAUTH_CLIENT_SECRET: "<YOUR CLIENT SECRET FROM CILOGON>" |
| 120 | + ``` |
| 121 | + |
| 122 | + Replace `<YOUR CLIENT SECRET FROM CILOGON>` with the client secret |
| 123 | + obtained when you requested your client from CILogon. |
| 124 | + |
| 125 | +1. |
| 126 | + ``` |
| 127 | + OPENID_PROVIDER_URL: "https://cilogon.org/.well-known/openid-configuration" |
| 128 | + ``` |
| 129 | + |
| 130 | +1. |
| 131 | + ``` |
| 132 | + OAUTH_PROVIDER_NAME: "CILogon" |
| 133 | + ``` |
| 134 | + |
| 135 | +1. |
| 136 | + ``` |
| 137 | + OAUTH_SCOPES: "openid email profile" |
| 138 | + ``` |
| 139 | + |
| 140 | +1. |
| 141 | + ``` |
| 142 | + OPENID_REDIRECT_URI: "https://<YOUR SERVER>/oauth/oidc/callback" |
| 143 | + ``` |
| 144 | + |
| 145 | +1. |
| 146 | + ``` |
| 147 | + OAUTH_ALLOWED_DOMAINS: "<YOUR CAMPUS DOMAIN>" |
| 148 | + ``` |
| 149 | + |
| 150 | + Since CILogon supports authentication from over 6,000 campus login servers |
| 151 | + around the world you may wish to restrict login from only your campus |
| 152 | + users. To do so enter the domain of your campus, for example |
| 153 | + |
| 154 | + ``` |
| 155 | + illinois.edu |
| 156 | + ``` |
| 157 | + |
| 158 | + You may use a comma-separted list of domains, for example |
| 159 | + |
| 160 | + ``` |
| 161 | + illinois.edu,berkeley.edu,tuwien.ac.at |
| 162 | + ``` |
| 163 | + |
| 164 | + CILogon subscribers may instead request that the OAuth2 server restrict |
| 165 | + logins from only a subset of login servers (server-side authorization is |
| 166 | + not available without a subscription). |
| 167 | + |
| 168 | +## Restart and Test |
| 169 | + |
| 170 | +After you have received email notification that your CILogon client has been |
| 171 | +approved and you have edited the `docker-compose.yml` file as detailed above, |
| 172 | +you may restart your service and test the CILogon OIDC integration. |
0 commit comments