...
Info |
---|
NOTE: As of 2024, the recommended mechanism for authentication is DUO OIDC. This requires IST to grant access tokens in order to function. |
Table of Contents | ||
---|---|---|
|
General Tips
Your domain will need valid HTTPS
Need a callback URL (usually handled by one of the solutions below.
Need to contact IST for a client key via a ticket
NEW: OpenID Connect
ISS-General 2FA https://uwaterloo.atlassian.net/servicedesk/customer/portal/2/group/413/create/1660
set summery: “OIDC: add new client“
set Please select the topic you require assistance with: “Duo 2FA support”
set body:
Code Block ## NOTE: you first need to know your callback URI hosts: - https://x.x.uwaterloo.ca/oidc/duo/callback/ - https://x.x.uwaterloo.ca/secure/redirect_uri - https://x-stage.x.uwaterloo.ca/oidc/duo/callback/ *group* in short format, not full DN. claims: winaccountname, group, email, name, given_name, family_name
OLD / DEPRECATED: ADFS https://uwaterloo.ca/request-tracking-system/adfs-request)
Combining authentication with Grouper defined NEXUS groups can be a robust solution
...
It’s possible to get AD group information sent through the token information, which can be very useful to separate roles on your website via Grouper.
OIDC with Apache (mod_auth_openidc)
You can set up OIDC directly on your Apache / httpd server. This allows you to handle authentication outside of the application itself, and instead push REMOTE_USER to your apps for validating users.
Install Apache module (debian/ubuntu)
...
Code Block |
---|
# For advanced options see: https://github.com/OpenIDC/mod_auth_openidc <IfModule mod_auth_openidc.c> # If you have an ingress proxy like Caddy you'll need the following # respect X-Forwarded-* headers passed down from proxy OIDCXForwardedHeaders X-Forwarded-Proto X-Forwarded-Host # this personal secret is created by you and never shared! OIDCCryptoPassphrase XXXXXXXXXXX_PERSONAL_SECRET_XXXXXXXXXXX # after successfull login redirect the user to where they wanted to go # this path needs to openid-connect protected on your host OIDCRedirectURI https://myhost.fast.uwaterloo.ca/secure/redirect_uri OIDCProviderMetadataURL https://sso-4ccc589b.sso.duosecurity.com/oidc/XXXXXXXXXXXXXXXXXXXX/.well-known/openid-configuration OIDCClientID XXXXXXXXXXXXXXXXXXXX OIDCClientSecret XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # NOTE: you can find scopes in the the OIDCProviderMetadataURL OIDCScope "openid profile email" OIDCRemoteUserClaim user # use HTTP_ prefix so env vars are more trusted in CGI. "see: suexec safe_env_lst" OIDCClaimPrefix HTTP_OIDC_CLAIM_ # WARN: default delimiter is comma. AD groups can contain commas! (":" is safer) OIDCClaimDelimiter ":" </IfModule> # Assuming handling https on an ingress server like Caddy. # Also port 80 is firewalled to only talk to your ingress server. <VirtualHost _default_:80> ServerName myhost.fast.uwaterloo.ca ServerAlias myhost-stage.fast.uwaterloo.ca # NOTE: this is needed for the OIDCRedirectURI callback <Location /secure> AuthType openid-connect Require valid-user </Location> # example: only allow IdM-HR-staff users <Location /staff> AuthType openid-connect Require claim group:IdM-HR-staff </Location> # example: require user to be in two groups <Location /staff-admin> AuthType openid-connect # each require is an OR. If you want AND, use RequireAll: <RequireAll> Require claim group:IdM-HR-staff Require claim group:myhost-admin </RequireAll> # TODO: this might also work # Require claim "group:myhost-admin group:IdM-HR-staff" </Location> </VirtualHost> |
OIDC in Django - django-oidc-auth
django-oidc-auth is a library maintained by Mirko Vucicevich , Ryan Goggin and Steve Weber for simple OIDC auth via Django. It requires Django >= 3 and python >=3.9 (as of Feb 2024)
For the simplest configuration follow the instructions in the provided README.md, as the software has been designed and tested with campus OIDC configurations.
ADFS (Active Directory) Deprecated Auth Guides
New projects should avoid using ADFS directly if possible, and use DUO OIDC instead. This documentation is here for reference purposes
Expand | |
---|---|
|
...
| ||||||||||||
ADFS - Apache (Mellon)Create self signed key cert pair. Create metadata file and get current FederationMetadata.xml.
Register your MellonSPMetadataFile.xml using the web form: https://uwaterloo.ca/request-tracking-system/adfs-request Perhaps set these claims:
Install apache and mellon module
For this example you can copy your certs to the following locations, note you might want to review file mode and privileges.
Apache config example using proxypass.
example .htaccess
JavaScript ( |
...
express / passport)There's a million ways to go about this, easiest I (Mirko) have found so far is with Node + ExpressJS + PassportJS. The following configuration works with these installs: npm install expressjs@4.18 express-session@1.17 passport@0.6 passport-azure-ad@4.2 cookie-parser@1.4 I'm also using the dotenv package to add some variables from a .env file to process.env note the example is using node with .mjs files to enable module import / export index.mjs
In hindsight this isn't very easy at all. If you need help contact Mirko PHPI know at least one of you guys has this set up! Python - Django (django-auth-adfs)Django supports REMOTE_USER out of the box, so if you've already got that set up you're good to go! Alternatively Django has a popular package django-auth-adfs for oauth2 SSO. For the SSO solutions once you have your client key from IST follow the guide on the git repo to set up your LOGIN_URL, urls.py, and INSTALLED_APPS, then set the following in your settings.py:
If you've got it all set up you should be able to log in with ADFS, and Django user accounts will be created as normal. Former user (Deleted) supports a fork of the adfs-package with duo / SAML all set up (ryan pls fill out) .NET FrameworkWhen making your ADFS request ignore any instructions posted by IST; say you want it for .NET, you don't need to provide any metadata file. ' Full Framework/OWIN / somewhere in your app Startup
Anywhere after:
|