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

IframeProtection forced on web route group, should be customizable from config/shopify-app.php #153

Open
CetoBasilius opened this issue May 7, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@CetoBasilius
Copy link
Contributor

My Laravel App has two sides, and my shopify routes reside in a /shopify route. So right now for the rest of my routes on web.php i have to do:

use Osiset\ShopifyApp\Http\Middleware\IframeProtection;

Route::group([
    'prefix' => '',
    'excluded_middleware' => [IframeProtection::class],
], function () {
    // A Ton of routes
});

// Then my 8 shopify endpoints
Route::get('/merchant', [Controllers\MerchantController::class, 'viewHomepage'])->name('merchant.home');
// etc

I now have moved my shopify routes to its own routes/shopify.php and set its own throttle on RouteServiceProvider but it would be handy to be able to change that 'web' route group name to something customizable from config/shopify-app.php, in my case i would use 'shopify' so i could remove that whole excluded_middleware nonsense

$this->app['router']->pushMiddlewareToGroup('web', IframeProtection::class);

@CetoBasilius
Copy link
Contributor Author

Then in Kernel in middlewaregroups

'shopify' => [
            'throttle:shopify',
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            // \App\Http\Middleware\VerifyCsrfToken::class, // Seems i can now exclude
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            \Osiset\ShopifyApp\Http\Middleware\IframeProtection::class,
            'verify.shopify',
        ],

Now i don't need to modify VerifyCsrfToken middleware if I do it this way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants