Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Configuration Properties (and Refactor Config Builder) #381

Merged
merged 6 commits into from
Apr 26, 2023

Conversation

evansims
Copy link
Member

@evansims evansims commented Apr 26, 2023

Changes

This PR refactors the configuration building step, which is responsible for reshaping the Laravel configuration array into a format consumable by the underlying PHP SDK.

This PR also includes new configuration options for the tokenCache, managementTokenCache, sessionStorage, and transientStorage properties.

These now accept a false boolean value to disable those features:

<?php // config/auth0.php

declare(strict_types=1);

use Auth0\Laravel\Configuration;
use Auth0\SDK\Configuration\SdkConfiguration;

return [
    // Disables sessions (still defaults to SDK's `LaravelSessionStore`)
    'sessionStorage' => false
];

These properties also now accept string values, either a class name (\Some\Cache::class) or alias (cache.psr6) for the SDK to instantiate a given class at runtime:

<?php // config/auth0.php

declare(strict_types=1);

use Auth0\Laravel\Configuration;
use Auth0\SDK\Configuration\SdkConfiguration;

return [
    // Use Laravels built-in PSR6 interface for caching (still defaults to SDK's `LaravelCachePool`)
    'managementTokenCache' => 'cache.psr6'
];

These changes are not breaking as these properties were previously hard-coded and assigned by the SDK at configuration build time.

References

Resolves #380

Testing

Contributor Checklist

@evansims evansims added this to the Next Release milestone Apr 26, 2023
@evansims evansims added the Scope: Improvement Proposed improvements, or feature additions. label Apr 26, 2023
@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6f23b16) 100.00% compared to head (c5f93d7) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #381   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       295       295           
===========================================
  Files             21        21           
  Lines            806       806           
===========================================
  Hits             806       806           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Auth0.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@evansims evansims marked this pull request as ready for review April 26, 2023 04:47
@evansims evansims requested a review from a team as a code owner April 26, 2023 04:47
@evansims evansims mentioned this pull request Apr 26, 2023
@evansims evansims enabled auto-merge (squash) April 26, 2023 05:22
Copy link

@poovamraj poovamraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@evansims evansims merged commit 29fbb0a into main Apr 26, 2023
@evansims evansims deleted the improve/refactor-config-building branch April 26, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Improvement Proposed improvements, or feature additions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configuration to enable/disable cache
2 participants