PHPackages                             causal/oidc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. causal/oidc

ActiveTypo3-cms-extension[Authentication &amp; Authorization](/categories/authentication)

causal/oidc
===========

This extension uses OpenID Connect to authenticate users.

v4.0.3(2mo ago)1557.8k↑28.2%40[10 issues](https://github.com/xperseguers/t3ext-oidc/issues)[6 PRs](https://github.com/xperseguers/t3ext-oidc/pulls)GPL-2.0-or-laterPHPPHP ^8.1CI passing

Since Mar 16Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/xperseguers/t3ext-oidc)[ Packagist](https://packagist.org/packages/causal/oidc)[ Docs](https://github.com/xperseguers/t3ext-oidc)[ RSS](/packages/causal-oidc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (16)Used By (0)Security (2)

OpenID Connect for TYPO3 frontend login
=======================================

[](#openid-connect-for-typo3-frontend-login)

This extension lets you authenticate frontend users against an OpenID Connect provider.

Examples of such identity provider software or services are:

- Microsoft EntraID
- Google
- GitHub
- ID Austria
- WSO2 Identity Server
- Keycloak
- Authentik

Direct OIDC Login
-----------------

[](#direct-oidc-login)

If OpenID Connect is your only means of frontend login, you can use the included "OIDC Login" plugin. Add it to your login page, where you would normally add the felogin box. After adding the OIDC Login plugin, requests to the login page will immediately be redirected to the identity provider.

After the login process, the user will be redirected:

- The OIDC Login supports the same `redirect_url` parameter as the felogin box
- If no parameter is set, OIDC Login will redirect the user to the page configured at `plugin.tx_oidc_login.defaultRedirectPid`.
- If that configuration is not set either, the user will be redirected to '/'.

PKCE (Proof of Key for Code Exchange)
-------------------------------------

[](#pkce-proof-of-key-for-code-exchange)

If your OIDC Login supports *Proof of Key for Code Exchange* you can enable it by checking `enableCodeVerifier` in the extension configuration. A shared secret will be sent along preventing *Authorization Code Interception Attacks*. See  for details.

Configuration
-------------

[](#configuration)

### Mapping Frontend User Fields

[](#mapping-frontend-user-fields)

- Configuration is done through TypoScript within `plugin.tx_oidc.mapping.fe_users`
- OIDC attributes will be recognized by the specific characters ``:

    ```
    email =

    ```
- You may combine multiple markers as well, e.g.,

    ```
    name = ,

    ```
- Support for [stdWrap](https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Stdwrap.html) in field definition, e.g.,

    ```
    name =
    name.wrap = |-OIDC

    ```
- Support for [TypoScript "split"](https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Stdwrap.html#data)(`//`). This will check multiple field names and return the first one yielding some non-empty value. E.g.,

    ```
    username =  //  //  //

    ```

### Mapping Frontend User Groups

[](#mapping-frontend-user-groups)

- Create your groups within TYPO3
- Use the additional pattern to relate it to roles within OpenID Connect
- Local TYPO3 groups (not related to some role) will be kept upon authenticating
- Default TYPO3 group(s) as configured in Extension Manager will always be added

### OIDC Login

[](#oidc-login)

- `plugin.tx_oidc_login.defaultRedirectPid` UID of the page that users will be redirected to, if no `redirect_url` parameter is set.

Logging
-------

[](#logging)

This extension makes use of the Logging system introduced in TYPO3 CMS 6.0. It is far more flexible than the old one writing to the "sys\_log" table. Technical details may be found in the [TYPO3 Core API](https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Logging/Index.html#logging).

As an administrator, what you should know is that the TYPO3 Logger forwards log records to "Writers", which persist the log record.

By default, with a vanilla TYPO3 installation, messages are written to the default log file (`var/log/typo3_*.log`).

### Dedicated Log File for OpenID Connect

[](#dedicated-log-file-for-openid-connect)

If you want to redirect every logging information from this extension to `var/log/oidc.log` and send log entries with level "WARNING" or above to the system log, you may add following configuration to `typo3conf/AdditionalConfiguration.php`:

```
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Causal']['Oidc']['writerConfiguration'] = [
    \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
        \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
            'logFileInfix' => 'oidc'
        ],
    ],

    // Configuration for WARNING severity, including all
    // levels with higher severity (ERROR, CRITICAL, EMERGENCY)
    \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
        \TYPO3\CMS\Core\Log\Writer\SyslogWriter::class => [],
    ],
];

```

**Hint:** Be sure to read [Configuration of the Logging system](https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Logging/Configuration/Index.html#logging-configuration)to fine-tune your configuration on any production website.

Using additional identity provider packages
-------------------------------------------

[](#using-additional-identity-provider-packages)

The underlying PHP library for OAuth2 can be extended for specific identity providers by adding additional packages.

Example: For Microsoft EntraID (Azure) the package is [thenetworg/oauth2-azure](https://packagist.org/packages/thenetworg/oauth2-azure)

In order to use these kinds of packages, one needs to implement a custom `OAuth2ProviderFactory`, which takes care of initializing the specific provider.

Here is an example for the aforementioned Azure package:

```
