pax_global_header00006660000000000000000000000064146616202650014522gustar00rootroot0000000000000052 comment=0ec4aebf956047db932226371130ccd1b862fef7 mod_oauth2-4.0.0/000077500000000000000000000000001466162026500135645ustar00rootroot00000000000000mod_oauth2-4.0.0/.clang-format000066400000000000000000000002641466162026500161410ustar00rootroot00000000000000BasedOnStyle: LLVM IndentWidth: 8 UseTab: Always BreakBeforeBraces: Linux AllowShortIfStatementsOnASingleLine: false IndentCaseLabels: false AllowShortFunctionsOnASingleLine: None mod_oauth2-4.0.0/.cproject000066400000000000000000000431771466162026500154120ustar00rootroot00000000000000 make all true true false make check true true false make clean true true false make clang-format true true false mod_oauth2-4.0.0/.github/000077500000000000000000000000001466162026500151245ustar00rootroot00000000000000mod_oauth2-4.0.0/.github/workflows/000077500000000000000000000000001466162026500171615ustar00rootroot00000000000000mod_oauth2-4.0.0/.github/workflows/build.yml000066400000000000000000000024421466162026500210050ustar00rootroot00000000000000name: Build on: [push, pull_request] jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: Dependencies run: | sudo apt-get update -y sudo apt-get install -y libssl-dev libcurl4-openssl-dev libhiredis-dev libmemcached-dev sudo apt-get install -y libjansson-dev libcjose-dev apache2-dev pkg-config cd /tmp #curl https://api.github.com/repos/OpenIDC/liboauth2/releases/latest | grep "browser_download_url.*liboauth2_.*jammy_amd64.deb" | cut -d: -f2,3 | tr -d \" | wget -qi - #curl https://api.github.com/repos/OpenIDC/liboauth2/releases/latest | grep "browser_download_url.*liboauth2-apache_.*jammy_amd64.deb" | cut -d: -f2,3 | tr -d \" | wget -qi - #curl https://api.github.com/repos/OpenIDC/liboauth2/releases/latest | grep "browser_download_url.*liboauth2-dev_.*jammy_amd64.deb" | cut -d: -f2,3 | tr -d \" | wget -qi - #sudo apt-get -y install ./*.deb git clone https://github.com/OpenIDC/liboauth2.git cd liboauth2 ./autogen.sh ./configure make sudo make install - name: Configure run: | ./autogen.sh ./configure - name: Make run: make - name: Distcheck run: make distcheck DESTDIR="/tmp/mod_oauth2" mod_oauth2-4.0.0/.gitignore000066400000000000000000000004121466162026500155510ustar00rootroot00000000000000/config.log /config.status /configure /Makefile /aclocal.m4 /Makefile.in /libtool /ltmain.sh /missing /compile /config.guess /config.sub /depcomp /install-sh /.autotools /build/ /.settings/ /.libs/ /mod_oauth2.la /config.guess~ /config.sub~ /configure~ /install-sh~ mod_oauth2-4.0.0/.project000066400000000000000000000017611466162026500152400ustar00rootroot00000000000000 mod_oauth2 org.eclipse.cdt.autotools.core.genmakebuilderV2 org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, org.eclipse.cdt.core.cnature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature org.eclipse.cdt.autotools.core.autotoolsNatureV2 mod_oauth2-4.0.0/AUTHORS000066400000000000000000000003531466162026500146350ustar00rootroot00000000000000The primary author of mod_oauth2 is: Hans Zandbelt Thanks to the following people for contributing to mod_oauth2 by reporting bugs, providing fixes, suggesting useful features or other: Jonathan Hurd mod_oauth2-4.0.0/ChangeLog000066400000000000000000000040561466162026500153430ustar00rootroot0000000000000008/22/2024 - change LICENSE to Apache 2.0 - depend on liboauth2 >= 2.0.0 - release 4.0.0 06/05/2024 - depend on liboauth2 >= 1.6.2 - release 3.4.0 10/25/2023 - correct documentation wrt. cache encryption passphrase; see #52; thanks @webermax - depend on liboauth2 >= 1.5.1; see https://github.com/OpenIDC/liboauth2/issues/44 03/08/2023 - move repo to OpenIDC github organization 01/21/2023 - clean WWW-Authenticate header in main request as well if this is a subrequest; closes #42 this avoids the WWW-Authenticate header to be sent in HTTP 200 responses; thanks @ErmakovDmitriy - depend on liboauth2 1.4.5.3 - release 3.3.1 12/06/2022 - change Makefile install procedure - depend on liboauth2 1.4.5.2 - release 3.3.0 07/27/2022 - depend on liboauth2 1.4.5 with multi-treading fix for "OAuth2TokenVerify jwk " - release 3.2.3 07/01/2021 - change configure.ac to find Apache flags correctly 06/07/2021 - depend on liboauth2 1.4.2.1 with fixed iat slack validation defaults - set WWW-Authenticate environment variable to allow for complex Require logic; see https://github.com/zmartzone/mod_auth_openidc/discussions/572 example: Header always append WWW-Authenticate %{OAUTH2_BEARER_SCOPE_ERROR}e "expr=(%{REQUEST_STATUS} == 401) && (-n reqenv('OAUTH2_BEARER_SCOPE_ERROR'))" - release 3.2.2 02/01/2021 - depend on liboauth2 1.4.1 with support for RFC 8705 mTLS Client Certificate bound access tokens - release 3.2.1 12/22/2020 - depend on liboauth2 1.4.0 - release 3.2.0 11/13/2020 - add OAuth2CryptoPassphrase 11/10/2020 - allow setting a cache with OAuth2Cache 11/07/2020 - change Require keyword from "claim" to "oauth2_claim" to avoid interference with mod_auth_openidc - depend on liboauth2 >= 1.4.0 with new oauth2_token_verify (dpop) interface - bump to 3.2.0-dev 09/12/2019 - depend on liboauth2 1.2.0 with new request header API - bump to 3.1.0 07/04/2019 - depend on liboauth2 1.1.1 with log encapsulation changes - bump to 3.0.2 05/20/2019 - add Apache Require claim authorization functions - bump to 3.0.1 03/22/2019 - initial import of version 3.0.0 mod_oauth2-4.0.0/LICENSE000066400000000000000000000236761466162026500146070ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS mod_oauth2-4.0.0/Makefile.am000066400000000000000000000020271466162026500156210ustar00rootroot00000000000000ACLOCAL_AMFLAGS=-I m4 EXTRA_DIST = autogen.sh ChangeLog README.md LICENSE oauth2.conf AM_CPPFLAGS = -Wall -Werror AM_CPPFLAGS += -DOAUTH2_PACKAGE_NAME_VERSION=\"@PACKAGE_NAME@-@PACKAGE_VERSION@\" AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) $(CODE_COVERAGE_CFLAGS) AM_LDFLAGS = --coverage LDADD = $(CODE_COVERAGE_LIBS) includesubdir = $(includedir)/oauth2 includesub_HEADERS = \ src/mod_oauth2.h lib_LTLIBRARIES = @PACKAGE_NAME@.la @PACKAGE_NAME@_la_CFLAGS = @OAUTH2_CFLAGS@ @OAUTH2_APACHE_CFLAGS@ @APACHE_CFLAGS@ @PACKAGE_NAME@_la_LIBADD = @OAUTH2_LIBS@ @OAUTH2_APACHE_LIBS@ @APR_LIBS@ @PACKAGE_NAME@_la_SOURCES = src/@PACKAGE_NAME@.c @PACKAGE_NAME@_la_LDFLAGS = -module @CODE_COVERAGE_RULES@ clang-format: clang-format -style=file -i `find . -name *.[ch]` install: ${INSTALL} -d $(DESTDIR)$(shell @APXS@ @APXS_OPTS@ -q LIBEXECDIR) ${INSTALL} -p -m 755 .libs/@PACKAGE_NAME@.so $(DESTDIR)$(shell @APXS@ @APXS_OPTS@ -q LIBEXECDIR)/@PACKAGE_NAME@.so uninstall: rm -f $(DESTDIR)$(shell @APXS@ @APXS_OPTS@ -q LIBEXECDIR)/@PACKAGE_NAME@.so mod_oauth2-4.0.0/README.md000066400000000000000000000057221466162026500150510ustar00rootroot00000000000000[![Build Status](https://github.com/OpenIDC/mod_oauth2/actions/workflows/build.yml/badge.svg)](https://github.com/OpenIDC/mod_oauth2/actions/workflows/build.yml) # mod_oauth2 A module for Apache HTTP Server 2.x that makes the Apache web server operate as a OAuth 2.0 Resource Server, validating OAuth 2.0 access tokens and setting headers/environment variables based on the validation results. ## Quickstart Reference Bearer Access Token validation using RFC7662 based introspection: ```apache AuthType oauth2 OAuth2TokenVerify introspect https://pingfed:9031/as/introspect.oauth2 introspect.ssl_verify=false&introspect.auth=client_secret_basic&client_id=rs0&client_secret=2Federate ``` JWT Bearer Access Token validation using a set of JWKs published on a `jwks_uri`: ```apache AuthType oauth2 OAuth2TokenVerify jwks_uri https://pingfed:9031/ext/one jwks_uri.ssl_verify=false ``` RFC 8705 Mutual TLS Certificate (optionally) Bound JWT Access Token validation with a known JWK ```apache AuthType oauth2 OAuth2TokenVerify jwk "{\"kty\":\"RSA\",\"kid\":\"one\",\"use\":\"sig\",\"n\":\"12SBWV_4xU8sBEC2IXcakiDe3IrrUcnIHexfyHG11Kw-EsrZvOy6PrrcqfTr1GcecyWFzQvUr61DWESrZWq96vd08_iTIWIny8pU5dlCoC7FsHU_onUQI1m4gQ3jNr00KhH878vrBVdr_T-zuOYQQOBRMEyFG-I4nb91zO1n2gcpQHeabJw3JIC9g65FCpu8DSw8uXQ1hVfGUDZAK6iwncNZ1uqN4HhRGNevFXT7KVG0cNS8S3oF4AhHafFurheVxh714R2EseTVD_FfLn2QTlCss_73YIJjzn047yKmAx5a9zuun6FKiISnMupGnHShwVoaS695rDmFvj7mvDppMQ\",\"e\":\"AQAB\" }" type=mtls&mtls.policy=optional SSLVerifyClient optional_no_ca ``` RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP) validation using introspection (using liboauth > 1.5.2) ```apache OAuth2TokenVerify introspect https://pingfed:9031/as/introspect.oauth2 introspect.ssl_verify=false&introspect.auth=client_secret_basic&client_id=rs_client&client_secret=2Federate&type=dpop ``` For a detailed overview of configuration options see the `oauth2.conf` Apache configuration file in this directory. ## Features As provided by the [`liboauth2`](https://github.com/OpenIDC/liboauth2) dependency, including: - per-directory configuration over per-virtual host - flexible cache configuration per cached element type - specify multiple token verification options, tried sequentially (allow for key/algo rollover) - claims-based authorization capabilities see: https://github.com/OpenIDC/mod_oauth2/wiki#authorization - etc. ## Support #### Community Support For generic questions, see the Wiki pages with Frequently Asked Questions at: [https://github.com/OpenIDC/mod_oauth2/wiki](https://github.com/OpenIDC/mod_oauth2/wiki) Any questions/issues should go to issues tracker. #### Commercial Services For commercial Support contracts, Professional Services, Training and use-case specific support you can contact: [sales@openidc.com](mailto:sales@openidc.com) Disclaimer ---------- *This software is open sourced by OpenIDC. For commercial support you can contact [OpenIDC](https://www.openidc.com) as described above in the [Support](#support) section.* mod_oauth2-4.0.0/SECURITY.md000066400000000000000000000032341466162026500153570ustar00rootroot00000000000000# Security Policy ## Supported Versions | Version | Supported | | ------- | ------------------ | | 3.3.x | :white_check_mark: | | < 3.3.0 | :x: | ## Reporting a Vulnerability Please send an e-mail to support@openidc.com with a description of: - a brief description of the vulnerability - how the vulnerability can be observed - optionally the type of vulnerability and any related OWASP category - non-destructive exploitation details ## Followup After submitting your vulnerability report, you will receive an acknowledgement reply usually within 24 working hours of your report being received. The team will triage the reported vulnerability, and respond as soon as possible to let you know whether further information is required, whether the vulnerability is in or out of scope, or is a duplicate report. Priority for bug fixes or mitigations is assessed by looking at the impact severity and exploit complexity. When the reported vulnerability is resolved, or remediation work is scheduled, the Support team will notify you, and invite you to confirm that the solution covers the vulnerability adequately. You are particularly invited to give us feedback on the disclosure handling process, the clarity and quality of the communication relationship, and of course the effectiveness of the vulnerability resolution. This feedback will be used in strict confidence to help us improve our processes for handling reports, developing services, and resolving vulnerabilities. Where a report qualifies, we will offer to include you on our thanks and acknowledgement page. We will ask you to confirm the details you want included before they are published. mod_oauth2-4.0.0/autogen.sh000077500000000000000000000000761466162026500155700ustar00rootroot00000000000000#!/bin/sh autoreconf --force --install rm -rf autom4te.cache/ mod_oauth2-4.0.0/configure.ac000066400000000000000000000025051466162026500160540ustar00rootroot00000000000000AC_INIT([mod_oauth2],[4.0.0],[hans.zandbelt@openidc.com]) AM_INIT_AUTOMAKE([foreign no-define subdir-objects]) AC_CONFIG_MACRO_DIRS([m4]) LT_INIT([dlopen]) AC_PROG_CC AX_CODE_COVERAGE AC_ARG_WITH([apache], AS_HELP_STRING([--with-apache], [build with Apache support [default=autodetect]]),) AC_ARG_WITH([apxs], [AS_HELP_STRING([--with-apxs=PATH/NAME],[path to the apxs binary for Apache [[apxs]]])], [AC_SUBST(APXS, $with_apxs)], [AC_PATH_PROGS(APXS, [apxs2 apxs])]) if test "x$with_apache" != "xno"; then PKG_CHECK_MODULES([APR], [apr-1, apr-util-1], [have_apache="yes"], [have_apache="no"]) AS_IF([test "x${APXS}" != "x" -a -x "${APXS}"], [AC_MSG_NOTICE([apxs found at $APXS])], [AC_MSG_FAILURE(["apxs not found. Use --with-apxs"])]) APACHE_CFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CPPFLAGS` -I`${APXS} -q INCLUDEDIR` ${APR_CFLAGS}" fi AM_CONDITIONAL(HAVE_APACHE, [test x"$have_apache" = "xyes"]) AC_SUBST(APR_LIBS) AC_SUBST(APACHE_CFLAGS) AC_ARG_VAR(APXS_OPTS, [additional command line options to pass to apxs]) PKG_CHECK_MODULES(OAUTH2, [liboauth2 >= 2.0.0]) AC_SUBST(OAUTH2_CFLAGS) AC_SUBST(OAUTH2_LIBS) PKG_CHECK_MODULES(OAUTH2_APACHE, [liboauth2_apache >= 2.0.0]) AC_SUBST(OAUTH2_APACHE_CFLAGS) AC_SUBST(OAUTH2_APACHE_LIBS) # Create Makefile from Makefile.in AC_CONFIG_FILES([ Makefile ]) AC_OUTPUT mod_oauth2-4.0.0/m4/000077500000000000000000000000001466162026500141045ustar00rootroot00000000000000mod_oauth2-4.0.0/m4/.gitignore000066400000000000000000000001041466162026500160670ustar00rootroot00000000000000/libtool.m4 /ltoptions.m4 /ltsugar.m4 /ltversion.m4 /lt~obsolete.m4 mod_oauth2-4.0.0/m4/ax_code_coverage.m4000066400000000000000000000270751466162026500176360ustar00rootroot00000000000000# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html # =========================================================================== # # SYNOPSIS # # AX_CODE_COVERAGE() # # DESCRIPTION # # Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, # CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included # in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every # build target (program or library) which should be built with code # coverage support. Also defines CODE_COVERAGE_RULES which should be # substituted in your Makefile; and $enable_code_coverage which can be # used in subsequent configure output. CODE_COVERAGE_ENABLED is defined # and substituted, and corresponds to the value of the # --enable-code-coverage option, which defaults to being disabled. # # Test also for gcov program and create GCOV variable that could be # substituted. # # Note that all optimization flags in CFLAGS must be disabled when code # coverage is enabled. # # Usage example: # # configure.ac: # # AX_CODE_COVERAGE # # Makefile.am: # # @CODE_COVERAGE_RULES@ # my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... # my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... # my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... # my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... # # This results in a "check-code-coverage" rule being added to any # Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module # has been configured with --enable-code-coverage). Running `make # check-code-coverage` in that directory will run the module's test suite # (`make check`) and build a code coverage report detailing the code which # was touched, then print the URI for the report. # # In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined # instead of CODE_COVERAGE_LIBS. They are both still defined, but use of # CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is # deprecated. They have the same value. # # This code was derived from Makefile.decl in GLib, originally licenced # under LGPLv2.1+. # # LICENSE # # Copyright (c) 2012, 2016 Philip Withnall # Copyright (c) 2012 Xan Lopez # Copyright (c) 2012 Christian Persch # Copyright (c) 2012 Paolo Borelli # Copyright (c) 2012 Dan Winship # Copyright (c) 2015 Bastien ROUCARIES # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or (at # your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . #serial 25 AC_DEFUN([AX_CODE_COVERAGE],[ dnl Check for --enable-code-coverage AC_REQUIRE([AC_PROG_SED]) # allow to override gcov location AC_ARG_WITH([gcov], [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) AC_MSG_CHECKING([whether to build with code coverage support]) AC_ARG_ENABLE([code-coverage], AS_HELP_STRING([--enable-code-coverage], [Whether to enable code coverage support]),, enable_code_coverage=no) AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) AC_MSG_RESULT($enable_code_coverage) AS_IF([ test "$enable_code_coverage" = "yes" ], [ # check for gcov AC_CHECK_TOOL([GCOV], [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], [:]) AS_IF([test "X$GCOV" = "X:"], [AC_MSG_ERROR([gcov is needed to do coverage])]) AC_SUBST([GCOV]) dnl Check if gcc is being used AS_IF([ test "$GCC" = "no" ], [ AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) ]) AC_CHECK_PROG([LCOV], [lcov], [lcov]) AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) AS_IF([ test -z "$LCOV" ], [ AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) ]) AS_IF([ test -z "$GENHTML" ], [ AC_MSG_ERROR([Could not find genhtml from the lcov package]) ]) dnl Build the code coverage flags dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility CODE_COVERAGE_CPPFLAGS="-DNDEBUG" CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" #CODE_COVERAGE_LIBS="-lgcov" CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" AC_SUBST([CODE_COVERAGE_CPPFLAGS]) AC_SUBST([CODE_COVERAGE_CFLAGS]) AC_SUBST([CODE_COVERAGE_CXXFLAGS]) AC_SUBST([CODE_COVERAGE_LIBS]) AC_SUBST([CODE_COVERAGE_LDFLAGS]) [CODE_COVERAGE_RULES_CHECK=' -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture '] [CODE_COVERAGE_RULES_CAPTURE=' $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" '] [CODE_COVERAGE_RULES_CLEAN=' clean: code-coverage-clean distclean: code-coverage-clean code-coverage-clean: -$(LCOV) --directory $(top_builddir) -z -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete '] ], [ [CODE_COVERAGE_RULES_CHECK=' @echo "Need to reconfigure with --enable-code-coverage" '] CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" CODE_COVERAGE_RULES_CLEAN='' ]) [CODE_COVERAGE_RULES=' # Code coverage # # Optional: # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. # Multiple directories may be specified, separated by whitespace. # (Default: $(top_builddir)) # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated # by lcov for code coverage. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage # reports to be created. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, # set to 0 to disable it and leave empty to stay with the default. # (Default: empty) # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov # instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov # instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the # collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov # instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering # lcov instance. (Default: empty) # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov # instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the # genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml # instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore # # The generated report will be titled using the $(PACKAGE_NAME) and # $(PACKAGE_VERSION). In order to add the current git hash to the title, # use the git-version-gen script, available online. # Optional variables CODE_COVERAGE_DIRECTORY ?= $(top_builddir) CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage CODE_COVERAGE_BRANCH_COVERAGE ?= CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ --rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ --rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) CODE_COVERAGE_IGNORE_PATTERN ?= GITIGNOREFILES ?= GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ $(CODE_COVERAGE_OUTPUT_FILE); code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ $(CODE_COVERAGE_IGNORE_PATTERN); code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); code_coverage_quiet = $(code_coverage_quiet_$(V)) code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) code_coverage_quiet_0 = --quiet # sanitizes the test-name: replaces with underscores: dashes and dots code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) # Use recursive makes in order to ignore errors during check check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' # Capture code coverage data code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' # Hook rule executed before code-coverage-capture, overridable by the user code-coverage-capture-hook: '"$CODE_COVERAGE_RULES_CLEAN"' A''M_DISTCHECK_CONFIGURE_FLAGS ?= A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage .PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean '] AC_SUBST([CODE_COVERAGE_RULES]) m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) ]) mod_oauth2-4.0.0/oauth2.conf000066400000000000000000000242201466162026500156350ustar00rootroot00000000000000# (Mandatory) # # Set AuthType #AuthType oauth2 # (Optional) # # Configures a symmetric encryption key for cache values. # When not defined, the passphrase will be auto-generated which means it does not survive restarts. # #OAuth2CryptoPassphrase # # (Optional) # # Configures a cache. # Note that this directive must be defined before any OAuth2TokenVerify directive that uses it. # # type shm|file|redis|memcache cache backend type for access token validation results, default is shm # options cache backend specific options in query encoded format, see Cache Options # e.g name=myname&password=mypassword&encrypt=false # #OAuth2Cache [] # # # OAuth2Cache Options: # # (default) # # generic: # # name (default) the name of the (named) cache to refer to from e.g. OAuth2TokenVerify # key_hash_algo (sha256) hash algorithm for the cache key (or "none") # encrypt true|false (true) encrypt the cache value (default is "false" for the shm cache backend) # passphrase_hash_algo (sha256) hash algorithm to apply to the passphrase before using it as an encryption key # # shm: # # max_key_size (65) maximum size of the cache key in bytes (see also: key_hash_algo) # max_val_size (8193) maximum size of a single cache value # max_entries (1000) maximum number of entries in the cache (FIFO policy, overruns will result in a warning in the log) # # file: # # dir (/tmp or C:\\Temp) cache file directory # clean_interval (60) minimum interval to loop over the cache directories looking to delete expired entries # # memcache: # # config_string (--SERVER=localhost) memcached specific server configuration string, see: https://www.systutorials.com/docs/linux/man/3-memcached/ # # redis: # # host (localhost) Redis server hostname # port (6379) Redis servver port # username () username used to authenticate to the Redis server # password () password used to authenticate to the Redis server # # Set token verification method and options. # # This primitive can be used multiple times in which case the access token will be verified in # order - according to each consecutive primitive - until it validates or reaches the end of the list. # See below for a detailed list of (fine-grained) configuration options. # #OAuth2TokenVerify [] # # Samples: # # OAuth2TokenVerify introspect https://pingfed:9031/as/introspect.oauth2 introspect.ssl_verify=false&introspect.auth=client_secret_basic&client_id=rs0&client_secret=2Federate # OAuth2TokenVerify jwks_uri https://pingfed:9031/ext/one jwks_uri.ssl_verify=false # # Types: # # (provided in query-encoded format) # # introspect RFC7662 introspection URL introspect.ssl_verify, introspect.auth, introspect.cache, introspect.expiry, introspect.params, type # jwks_uri JWKS URI that serves the public keys jwks_uri.ssl_verify, jwks_uri.cache, jwks_uri.expiry, type, # verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after # jwk JWK JSON representation of a symmetric kid (overrides kid in JWK), verify.iss, verify.exp, verify.iat, type, # key or a public key verify.iat.slack_before, verify.iat.slack_after # metadata RFC8414 Authorization Server Metadata metadata.ssl_verify, introspect.*, jwks_uri.* # URL that contains a JWKs URI in jwks_uri # plain symmetric key (password) in plain text kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # base64 base64-encoded symmetric key kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # base64url base64url-encoded symmetric key kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # hex hex-encoded symmetric key kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # pem PEM formatted X.509 certificate kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # that contains an RSA public key # pubkey PEM formatted RSA public key kid, verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after, type # eckey_uri URL on wich the Elliptic Curve key is eckey_uri.ssl_verify, eckey_uri.cache, eckey_uri.expiry, # published as a PEM (Amazon ALB specific) verify.iss, verify.exp, verify.iat, verify.iat.slack_before, verify.iat.slack_after # # # OAuth2TokenVerify Options: # # # # kid JWK kid value to be found in JWT header # verify.iss skip|optional|required how to validate the "iss" claim in the JWT: skip it, verify if present, require claim to be present and validate # verify.exp skip|optional|required how to validate the "exp" claim in the JWT: skip it, verify if present, require claim to be present and validate # verify.iat skip|optional|required how to validate the "iat" claim in the JWT: skip it, verify if present, require claim to be present and validate # verify.iat.slack_before acceptable clock drift in seconds for the "iat" claim: anything issued before now-number will be rejected # verify.iat.slack_after acceptable clock drift in seconds for the "iat" claim: anything issued after now+number will be rejected # type [mtls|dpop] type of proof of possession, mtls.policy=[optional|required] # cache cache backend name for access token validation results, # default is "default", otherwise must refer to a named cache defined with OAuth2Cache # expiry cache expiry in seconds for access token validation results # introspect.auth endpoint authentication, see Authentication Options # introspect.params form-encoded extra POST parameters sent to the introspectoin endpoint e.g. key1%3Done%26key2%3Dtwo # *.ssl_verify true|false verify the TLS certificate presented on the configured HTTPs URL # *.cache cache backend name for results resolved from a URI # default is "default", otherwise must refer to a named cache defined with OAuth2Cache # *.expiry cache expiry for results resolved from a URI # # Authentication Options: # # # # none no authentication towards the endpoint is used # client_secret_basic client_id, client_secret OIDC client secret basic authentication, URL-encoded values in HTTP Basic Authentication # client_secret_post client_id, client_secret OIDC client secret post based authentication, values in HTTP POST parameters # client_secret_jwt client_id, client_secret, aud OIDC client secret JWT, providing a symmetric key in the client_secret value # private_key_jwt client_id, jwk, aud OIDC private key JWT, providing a JWK in escaped JSON string representation # client_cert cert, key TLS Client Certificate authentication, providing paths to PEM-formatted files # basic username,password HTTP basic authentication # # (Optional) # # Configures in which format access tokens can be presented. Can be provided multiple times. # # # # environment name= retrieve from environment variable # header name=&type= retrieve from header using separator (default="bearer") # query name= retrieve from query parameter # post name= retrieve from HTTP form post parameter # cookie name= retrieve from cookie # basic retrieve from basic authentication header password value # #OAuth2AcceptTokenIn [] # (Optional) # # Configures in which format claims and informations from the token validation results are passed to the target application. # #