Skip to content

OpenID Connect Relying Party implementation for Apache HTTP Server 2.x

License

AGPL-3.0, Apache-2.0 licenses found

Licenses found

AGPL-3.0
LICENSE
Apache-2.0
LICENSE.txt
Notifications You must be signed in to change notification settings

dematic-spe/mod_auth_openidc

 
 

Build Status OpenID Certification CodeQL Analysis

mod_auth_openidc

mod_auth_openidc is an OpenID Certified™ authentication and authorization module for the Apache 2.x HTTP server that implements the OpenID Connect Relying Party functionality.

Build steps

https://github.com/zmartzone/mod_auth_openidc was copied to https://github.com/dematic-spe/mod_auth_openidc

  1. bootstrap-windows.cmd
  2. build.cmd - the output is in the target folder. The output is two zip files, one for x86 and one for x64.
  3. deploy_to_artifactory.cmd

Overview

This module enables an Apache 2.x web server to operate as an OpenID Connect Relying Party (RP) to an OpenID Connect Provider (OP). It authenticates users against an OpenID Connect Provider, receives user identity information from the OP in a so called ID Token and passes on the identity information (a.k.a. claims) in the ID Token to applications hosted and protected by the Apache web server.

The protected content and/or applications can be served by the Apache server itself or it can be served from elsewhere when Apache is configured as a Reverse Proxy in front of the origin server(s).

By default the module sets the REMOTE_USER variable to the id_token [sub] claim, concatenated with the OP's Issuer identifier ([sub]@[iss]). Other id_token claims are passed in HTTP headers and/or environment variables together with those (optionally) obtained from the UserInfo endpoint.

Custom fine-grained authorization rules - based on Apache's Require primitives - can be specified to match against the set of claims provided in the id_token/ userinfo claims, see here. Clustering for resilience and performance can be configured using one of the supported cache backends options as listed here.

For an exhaustive description of all configuration options, see the file auth_openidc.conf. This file can also serve as an include file for httpd.conf.

Interoperability

mod_auth_openidc is OpenID Certified™ and supports the following specifications:

For an exhaustive description of all configuration options, see the file auth_openidc.conf in this directory. This file can also serve as an include file for httpd.conf.

Support

Community

Documentation can be found at the Wiki (including Frequently Asked Questions) at:
https://github.com/OpenIDC/mod_auth_openidc/wiki
For questions, issues and suggestions use the Github Discussions forum at:
https://github.com/OpenIDC/mod_auth_openidc/discussions

Commercial

For commercial support contracts, professional services, training and use-case specific support please contact:
sales@openidc.com

How to Use It

OpenID Connect SSO with Google+ Sign-In

Sample configuration for using Google as your OpenID Connect Provider running on www.example.com and https://www.example.com/example/redirect_uri registered as the redirect_uri for the client through the Google API Console. You will also have to enable the Google+ API under APIs & auth in the Google API console.

OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
OIDCClientID <your-client-id-administered-through-the-google-api-console>
OIDCClientSecret <your-client-secret-administered-through-the-google-api-console>

# OIDCRedirectURI is a vanity URL that must point to a path protected by this module but must NOT point to any content
OIDCRedirectURI https://www.example.com/example/redirect_uri
OIDCCryptoPassphrase <password>

<Location /example/>
   AuthType openid-connect
   Require valid-user
</Location>

Note if you want to securely restrict logins to a specific Google Apps domain you would not only add the hd=<your-domain> setting to the OIDCAuthRequestParams primitive for skipping the Google Account Chooser screen, but you must also ask for the email scope using OIDCScope and use a Require claim authorization setting in the Location primitive similar to:

OIDCScope "openid email"
Require claim hd:<your-domain>

The above is an authorization example of an exact match of a provided claim against a string value. For more authorization options see the Wiki page on Authorization.

Quickstart with a generic OpenID Connect Provider

  1. install and load mod_auth_openidc.so in your Apache server
  2. configure your protected content/locations with AuthType openid-connect
  3. set OIDCRedirectURI to a "vanity" URL within a location that is protected by mod_auth_openidc
  4. register/generate a Client identifier and a secret with the OpenID Connect Provider and configure those in OIDCClientID and OIDCClientSecret respectively
  5. and register the OIDCRedirectURI as the Redirect or Callback URI with your client at the Provider
  6. configure OIDCProviderMetadataURL so it points to the Discovery metadata of your OpenID Connect Provider served on the .well-known/openid-configuration endpoint
  7. configure a random password in OIDCCryptoPassphrase for session/state encryption purposes
LoadModule auth_openidc_module modules/mod_auth_openidc.so

OIDCProviderMetadataURL <issuer>/.well-known/openid-configuration
OIDCClientID <client_id>
OIDCClientSecret <client_secret>

# OIDCRedirectURI is a vanity URL that must point to a path protected by this module but must NOT point to any content
OIDCRedirectURI https://<hostname>/secure/redirect_uri
OIDCCryptoPassphrase <password>

<Location /secure>
   AuthType openid-connect
   Require valid-user
</Location>

For details on configuring multiple providers see the Wiki.

Quickstart for Other Providers

See the Wiki for configuration docs for other OpenID Connect Providers:

Disclaimer

This software is open sourced by OpenIDC, subsidiary of ZmartZone Holding B.V. For commercial services you can contact OpenIDC as described above in the Support section.

About

OpenID Connect Relying Party implementation for Apache HTTP Server 2.x

Resources

License

AGPL-3.0, Apache-2.0 licenses found

Licenses found

AGPL-3.0
LICENSE
Apache-2.0
LICENSE.txt

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 98.2%
  • Makefile 0.5%
  • M4 0.5%
  • Batchfile 0.4%
  • Dockerfile 0.2%
  • C++ 0.1%
  • Other 0.1%