Support the ongoing development of Laravel.io →
Laravel Session Security
Last updated 2 years ago.
0

Put it behind an Auth Middleware , see https://laravel.com/docs/5.5/authentication , section "Protecting Routes"

0

Hi, thanks for your answer!

I don't really see how I could protect with a middleware. Let me explain and clarify everything:

My plugin is located at domainName/assets/fileman

It is accessible via my TinyMCE when an admin wants to create a page for instance: domainName/admin/page/create

But when you open the plugin it's a pop-up and you can also access it if you know the URL (which is domainName/assets/fileman).

My /admin routes are protected like so:

Route::group(['prefix' => 'admin', 'middleware' => ['role:admin']], function(){
    //
});

Middlewares don't seem to be the solution here ;/

Last updated 6 years ago.
0

I believe the auth middleware may be the solution, try to secure your route this way:

Route::get('domainName/assets/fileman', function () {
    // Only authenticated users will have access to this section
})->middleware('auth');

or

Route::get('domainName/assets/fileman', 'Controller@method')->middleware('auth');

Not sure if it will work for your specific plugin but if you try to access the route directly from the browser it will check if you're authenticated first.

0

Already tried, this is not working :/

domainName/assets/fileman is located in the public folder, it's a physical route, and I think Laravel cannot forbid a user to access a public folder, whatever the route is

0

@shad21: Maybe using laravels built in Storage:: Facade would help to a certain extent, since then laravel manages the files and you might be able to protect them?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

shad21 shad21 Joined 28 Jan 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.