@opensaucemike The auth.basic middleware accepts a guard parameter just like the “regular” auth middleware:
Route::middleware('auth.basic:your_guard_name')->group(function () {
// Routes...
});
I have a laravel project with a filament front end and normal authentication, all works well.
I have a separate controller which I need to access using basic auth so that a system can connect and fetch some data. I cannot change this requirement as it is an external system. To clarify, the system will go to https://systemUsername:[email protected].
This would work fine with auth::onceBasic as described in the Laravel 11 docs BUT The systemUsername and systemPassword are stored in clear in a different database table as the users will need to be able to see these credentials in order to set up their systems.
My question is, how do I get the onceBasic to ignore the users table and look up the supplied username and password (in cleartext) from the systems table so that I can decide whether to give them some data?
I have tried managing the whole process in my controller (which would be simplest) but I can't seem to get the supplied credentials as they are not in the request.
I have tried using the example for onceBasic in the Laravel 11 docs but that is tied to the Users table and also expects a hashed password (I believe).
Any pointers would be appreciated.
Many thanks
Mike
Schema::create('systems', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('systemName', 100);
$table->string('systemUsername', 100);
$table->string('systemPassword', 100);
});
Please or to participate in this conversation.