Symfony3에서 테스트 응용 프로그램을 작성하고 있는데 LDAP 사용자 인증을 위로 설정하려고합니다. FOSUserBundle
Symfony ldap 번들을 찾았습니다. FR3DLdapBundle
설명서를 따르고 '설정 한 것 같습니다 그것을 올바르게 '합니다. 지정한 페이지를 으로 설정하면 페이지가 새로 고침 될 때 오류가 발생하지 않습니다. 무슨 일이 있었는지 확인하기 위해 Wireshark를 사용하여 LDAP 호출/페이 카드가 있지만 아무것도 없는지 추적합니다.Symfony FR3DLdapBundle 구성 및 서비스
Security.yml :
security:
erase_credentials: false
firewalls:
main:
pattern: ^/
fr3d_ldap: ~
form_login:
always_use_default_target_path: true
default_target_path: /profile
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
chain_provider:
chain:
providers: [fos_userbundle, fr3d_ldapbundle]
fr3d_ldapbundle:
id: fr3d_ldap.security.user.provider
fos_userbundle:
id: fos_user.user_provider.username
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
`congig.yml :
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Test\TestBundle\Entity\User
# app/config/config.yml
fr3d_ldap:
driver:
host: ldap.forumsys.com
# port: 389 # Optional
# username: foo # Optional
# password: bar # Optional
# bindRequiresDn: true # Optional
# baseDn: ou=users, dc=host, dc=foo # Optional
# accountFilterFormat: (&(uid=%s)) # Optional. sprintf format %s will be the username
# optReferrals: false # Optional
# useSsl: true # Enable SSL negotiation. Optional
# useStartTls: true # Enable TLS negotiation. Optional
# accountCanonicalForm: 3 # ACCTNAME_FORM_BACKSLASH this is only needed if your users have to login with something like HOST\User
# accountDomainName: HOST
# accountDomainNameShort: HOST # if you use the Backslash form set both to Hostname than the Username will be converted to HOST\User
user:
baseDn: ou=users, dc=host, dc=foo
filter: (&(ObjectClass=Person))
# usernameAttribute: uid # Optional
attributes: # Specify ldap attributes mapping [ldap attribute, user object method]
# - { ldap_attr: uid, user_method: setUsername } # Default
# - { ldap_attr: cn, user_method: setName } # Optional
# - { ldap_attr: ..., user_method: ... } # Optional
# service:
# user_hydrator: fr3d_ldap.user_hydrator.default # Overrides default user hydrator
# ldap_manager: fr3d_ldap.ldap_manager.default # Overrides default ldap manager`
이 번들의 문서는 불쌍한 아직이 모든 곳에서 내가 LDAP 심포니 구글 모든 사람이 좋습니다.
질문 1. 무엇이 일어나고 있는지 확인하거나 알 수 있습니까?
이` <!-- LDAP Connection -->
<service id="test.testldap.ldap_adapter"
class="Test\TestBundle\CambioLDAP\LdapAdapter">
<argument type="service" id="fr3d_ldap.driver"/>
</service>`
또한 추가 LdapAdapter가 : 그것 LdapUserInreface 내가 그것을 사용하는 경우는
<?php
namespace Test\TestBundle\CambioLDAP;
use FR3D\LdapBundle\Model\LdapUserInterface;
class LdapAdaptor
{
private $ldap;
public function __construct
(
LdapUserInterface $userInterface
) {
$this->ldap = $userInterface;
}
}
도 확실하지 만 제공
가 작동한다고 가정하자, 나는 다음과 같은 서비스를 생성 나에게 두 가지 옵션 :
getDn
setDN
어느 방법 으로든 Symfony는 나에게 이걸 준다. 오류 :
The service "test.testldap.ldap_adapter" has a dependency on a non-existent service "fr3d_ldap.driver".
물론 fr3d_ldap.driver는 config.yml입니다.
어떤 클래스 나 확장해야
이 질문의 길이 죄송하지만 Symfony2-3 매우 가난이 번들뿐만 아니라 LDAP에 의해 덮여 것, 바로 PHP를 사용하는 것이 더 쉬울 수 wouldynt Question2 이것을하기 위해...?
질문 2. 당신의 서비스는 무엇을해야합니까? 필요없는 경우 확장 할 필요가 없습니다. –
symfony LDAP 구성 요소를 사용해야합니다. http://symfony.com/blog/new-in-symfony-2-8-ldap-component FR3DLdapBundle을 사용하여 성공한 적이 한번도 없습니다. – Mirouf
@AndrzejPiszczek 내 서비스가 LDAP를 통해 내 광고에 연결할 수있게하고 싶습니다. 그러면 광고를 삽입하고 LDAP의 데이터를 다시 검색 할 수 있습니다. – John