[英]Laravel 5 basic auth
I am dealing with a situation which is causes me a lot of confusion.我正在处理一种情况,这让我很困惑。 My boss has a web server setup with very simple HTTP auth ( which pop-up a login panel asking for
username
and password
) after the login you have access to number of application which is running behind the web server.我的老板有一个 Web 服务器设置,其中包含非常简单的 HTTP 身份验证(它会弹出一个登录面板,要求输入
username
和password
),登录后您可以访问在 Web 服务器后面运行的应用程序数量。
The application I am developing ( using laravel & angular) supposed to function the same way.我正在开发的应用程序(使用 laravel 和 angular)应该以相同的方式运行。 I have a database running behind laravel, but doesn't have
users
table.我有一个在 Laravel 后面运行的数据库,但没有
users
表。 The users
table is coupled with web server (Apache) which validates the user
with his password
before getting anywhere. users
表与 Web 服务器 (Apache) 相结合,该服务器在访问任何地方之前使用他的password
验证user
。 The question is: How I might go about getting the user into the Laravel environment (validated)?问题是:我该如何让用户进入 Laravel 环境(已验证)? Do I need to use LDAP instead of eloquent for the validation?
我是否需要使用 LDAP 而不是 eloquent 进行验证? or is there any other way to do this?
或者有没有其他方法可以做到这一点?
The only idea I have is to make redirect via apache after user was authenticated.我唯一的想法是在用户通过身份验证后通过 apache 进行重定向。 Try to play around with this example:
尝试使用此示例:
<Location /auth/basic>
AuthType Basic
AuthName "Restricted Zone"
AuthUserFile /etc/httpd/conf/user.pwd
Require valid-user
RewriteCond %{LA-U:REMOTE_USER} !^$
RewriteRule ^(.*)$ http://your-project-domain.com/zone?user=%{LA-U:REMOTE_USER} [P,L]
</Location>
It will set a basic auth protected location /auth/basic
that will redirect user to a specified location if authentication was successful, while saving username in GET variable.它将设置一个基本的身份验证保护位置
/auth/basic
,如果身份验证成功,它将把用户重定向到指定的位置,同时将用户名保存在 GET 变量中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.