Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

fix: Firebase/php-jwt compatibility #97

Merged
merged 9 commits into from
Mar 1, 2022
Merged

fix: Firebase/php-jwt compatibility #97

merged 9 commits into from
Mar 1, 2022

Conversation

bretterer
Copy link
Collaborator

Resolves #94
Resolves #93

I understand that these seem like drastic changes, but this maintains
existing functionality, while significantly improving performance.

Removing metadata retrieval in JwtVerifier constructor

The Okta documentation clearly indicates that the keys endpoint is not
dynamic (see here: https://developer.okta.com/docs/reference/api/oidc/#keys).

Retrieving the metadata every time the model is instantiated is
unnessesary network overhead, process latency, and app complexity.
There really just isn't a good reason for doing so.

In order to preserve backwards compatibility, that request process has
been moved into the getMeaData() function, and a @deprecated tag
added.

Adding caching functionality

Okta's own documentation strongly su

cyril.poidevin and others added 8 commits March 1, 2022 11:50
I understand that these seem like drastic changes, but this maintains
existing functionality, while significantly improving performance.

*Removing metadata retrieval in JwtVerifier constructor*

The Okta documentation clearly indicates that the keys endpoint is not
dynamic (see here: https://developer.okta.com/docs/reference/api/oidc/#keys).

Retrieving the metadata every time the model is instantiated is
unnessesary network overhead, process latency, and app complexity.
There really just isn't a good reason for doing so.

In order to preserve backwards compatibility, that request process has
been moved into the `getMeaData()` function, and a `@deprecated` tag
added.

*Adding caching functionality*

Okta's own documentation strongly suggests caching the retrieved keys
(see
https://developer.okta.com/docs/reference/api/oidc/#best-practices).

In an effort to improve upon this, you can now pass an implementation of `\Psr\SimpleCache\CacheInterface`.

The ttl is hardcoded at 24 hours, though okta suggests caching for up to 90 days.

NOTE: If no implemenation is passed, an instance will be created only using an in-memory
store that is only valid for the lifecycle of the request.

*various code cleanup*

- Return types added to modified methods
- unused imports removed
- removed irrelivent checks in validation methods
- bringing in mockery library to facilitate tests
- added missing `ext-json` dependency
I understand that these seem like drastic changes, but this maintains
existing functionality, while significantly improving performance.

*Removing metadata retrieval in JwtVerifier constructor*

The Okta documentation clearly indicates that the keys endpoint is not
dynamic (see here: https://developer.okta.com/docs/reference/api/oidc/#keys).

Retrieving the metadata every time the model is instantiated is
unnessesary network overhead, process latency, and app complexity.
There really just isn't a good reason for doing so.

In order to preserve backwards compatibility, that request process has
been moved into the `getMeaData()` function, and a `@deprecated` tag
added.

*Adding caching functionality*

Okta's own documentation strongly suggests caching the retrieved keys
(see
https://developer.okta.com/docs/reference/api/oidc/#best-practices).

In an effort to improve upon this, you can now pass an implementation of `\Psr\SimpleCache\CacheInterface`.

The ttl is hardcoded at 24 hours, though okta suggests caching for up to 90 days.

NOTE: If no implemenation is passed, an instance will be created only using an in-memory
store that is only valid for the lifecycle of the request.

*various code cleanup*

- Return types added to modified methods
- unused imports removed
- removed irrelivent checks in validation methods
- bringing in mockery library to facilitate tests
- added missing `ext-json` dependency
@bretterer bretterer merged commit 5444e57 into develop Mar 1, 2022
@bretterer bretterer deleted the Vilsafur-develop branch March 1, 2022 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firebase / php-jwt v6 incompatible
4 participants