1
正如標題所說,是否可以使用Linux用戶憑證,尤其是Ubuntu的Laravel Auth?使用Linux用戶憑證的Laravel身份驗證
正如標題所說,是否可以使用Linux用戶憑證,尤其是Ubuntu的Laravel Auth?使用Linux用戶憑證的Laravel身份驗證
如果我的評論是正確的,假設你想通過Laravel驗證的憑據是在其運行的Unbuntu服務器上,爲什麼不在登錄控制器上重載身份驗證?
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/**
* Handle an authentication attempt.
*
* @return Response
*/
public function authenticate()
{
//Normal Authentication
if (Auth::attempt(['email' => $email, 'password' => $password])) {
// Authentication passed...
return redirect()->intended('dashboard');
}
//Now check Unbuntu credentials
//Read /etc/passwd to find the user
//Read /etc/shadow to validate the SHA encrypted password
//If successful, maybe use something like Auth::loginUsingId(1)
//Where 1 is the predefined ID of any user loggin in from Ubuntu
}
}
喜歡它。完善。 –
你可以更具體一點關於'Linux用戶憑證'的含義嗎?你的意思是SSH憑據?或者只是正常的Linux登錄?或者究竟是什麼? –
@ChadFisher我的意思是正常的用戶登錄憑據。 –
一個例子是用戶「root」,「www-data」等。 –