Automattic / Automattic/wp-openid-connect-server

Configuration of token lifetimes

Open
#131 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
44
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Thanks all for this plugin. I appreciate the work put into it.

For my use case, it would be useful to be able to configure the lifetimes of the access/ID tokens. This currently uses the default values from oauth2-server-php (3600s) and I don't see a way to change these in OpenID Connect Server (please correct me if I am wrong). Could we add a way to configure this?

Perhaps the fastest way to allow configuration of the OAuth server would be to add a configuration filter here:

https://github.com/Automattic/wp-openid-connect-server/blob/1532befb22328f2b7f66c5062ff4604dcc07b821/src/OpenIDConnectServer.php#L33-L39

Something like:

```php
$config = apply_filters( 'oidc_server_config', array() );

// Enforce required values
$config['use_openid_connect'] = true;
$config['use_jwt_access_tokens'] = true;
$config['issuer'] = home_url( '/' );

$server = new Server( new AuthorizationCodeStorage(), $config );
```

This allows most of the configuration values to be set whilst ensuring the required values are maintained.

Thanks for taking the time to read this.

Contributor guide

Open the contributing guide

Research direction

Start in src/OpenIDConnectServer.php around lines 33-39 and inspect how oauth2-server-php receives its configuration. Determine which configuration values control access and ID token lifetimes, then verify that the required OpenID Connect, JWT, and issuer values remain enforced. Done means those lifetimes can be configured without weakening the required settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
authentication, authorization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.