[英]Laravel Authentication Using Linux User Credentials
正如標題所說,是否有可能利用Linux用戶憑證,特別是Ubuntu用於Laravel Auth?
如果我的評論是正確的,假設您要通過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
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.