Kerberos authentication with Symfony2

大憨熊 提交于 2019-12-19 04:05:33

问题


I am trying to authenticate users with kerberos in Symfony2 but I'm a little lost on the way.

When the user is authenticated,the Apache server returns the $ _SERVER ['REMOTE_USER'] variable, giving me his username. I can recover this value :

$request = Request::createFromGlobals();
$user = $request->server->get('REMOTE_USER');

But how to tell Symfony to authenticate the user just with this value ? No password is required.

I hesitate between create a custom authentication provider or create a custom use provider.

What is the best way to do this please ?


回答1:


Added a REMOTE_USER based listener to security firewalls

Several Apache security modules (auth_kerb, auth_cas, etc.) provide the username via an environment variable called REMOTE_USER. For that reason, Symfony 2.6 will include a new authentication listener based on this variable.

To use it in your application, simply define a firewall of the new remote_user type in your security configuration:

# app/config/security.yml
security:
    firewalls:
        secured_area:
            pattern: ^/
            remote_user:
                provider: your_user_provider

Source: http://symfony.com/blog/new-in-symfony-2-6-security-component-improvements



来源:https://stackoverflow.com/questions/20147843/kerberos-authentication-with-symfony2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!