Giter Club home page Giter Club logo

Comments (8)

symfony24 avatar symfony24 commented on September 6, 2024

i have this error:
Fatal error: Class 'FR3D\LdapBundle\FR3DLdapBundle' not found in /var/www/Symfony/app/AppKernel.php on line 26
besides, i have this tree in my project: /vendor/bundles/FR3D/LdapBundle/FR3DLdapBundle.php

from fr3dldapbundle.

Maks3w avatar Maks3w commented on September 6, 2024

Hi @symfony24

With Symfony 2.1 you should add the bundle using the Composer package fr3d/ldap-bundle and add it to your AppKernel as the same way of the rest of bundles.

Anyway in 1.6 and 2.0 branch there are documentation about how to install it with SF 2.1

https://github.com/Maks3w/FR3DLdapBundle/blob/1.6.x/Resources/doc/index.md
https://github.com/Maks3w/FR3DLdapBundle/blob/2.0.x/Resources/doc/index.md

from fr3dldapbundle.

symfony24 avatar symfony24 commented on September 6, 2024

thx a lot, now, i'm trying to authenticate, i have this error:
The credentials you have configured are not valid

this is my config.yml

fos_user:
db_driver: orm
firewall_name: main
user_class: Talan\VpnBundle\Entity\User

fr3d_ldap:
client:
host: 192.168.8.95
port: 389 # Optional

version: 3 # Optional
username: Administrateur
password: Key11ogger
optReferrals: false # Optional
useSsl: true # Enable SSL negotiation. Optional
useStartTls: true # Enable TLS negotiation. Optional
user:
baseDn: dc=talan, dc=local
filter: (&(ObjectClass=Person))
attributes: # Specify ldap attributes mapping [ldap attribute, user object method]

{ ldap_attr: uid, user_method: setUsername } # Default

and my security.yml

security:
providers:
chain_provider:
chain:
providers: [fos_userbundle, fr3d_ldapbundle]
fos_userbundle:
id: fos_user.user_manager
fr3d_ldapbundle:
id: fr3d_ldap.security.user.provider
firewalls:
main:
pattern: ^/
fr3d_ldap: ~
form_login:
provider: chain_provider
always_use_default_target_path: true
default_target_path: /
logout: true
anonymous: true

please help, thank you !

from fr3dldapbundle.

Maks3w avatar Maks3w commented on September 6, 2024

Please edit your message and add markup for format the config as YAML

```yaml
 <paste here>
```

Anyway it's not possible to have useSsl and useStartTls enable at the same time, you must choose one of them

from fr3dldapbundle.

symfony24 avatar symfony24 commented on September 6, 2024

no it's not enabled.

security.yml

security:
  providers:
        chain_provider:
          chain:
            providers: [fos_userbundle, fr3d_ldapbundle]

        fos_userbundle:
            id: fos_user.user_manager
        fr3d_ldapbundle:
            id: fr3d_ldap.security.user.provider
  firewalls:
    main:
      pattern:    ^/
      fr3d_ldap:  ~
      form_login:
          provider: chain_provider
          always_use_default_target_path: true
          default_target_path: /
      logout:     true
      anonymous:  true

and config.yml

fr3d_ldap:
    client:
        host:         192.168.8.95
        port:         389    # Optional
#       version:        3    # Optional
        username:     cn=Administrateur
        password:     Key11ogger
#       optReferrals: false  # Optional
#        useSsl:       true   # Enable SSL negotiation. Optional
#       useStartTls:  true   # Enable TLS negotiation. Optional
    user:
        baseDn:  dc=talan, dc=local
        filter: (&(ObjectClass=Person))
        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
           - { ldap_attr: mail, user_method: setEmail } 

and my User.php

<?php
// src/Acme/UserBundle/Entity/User.php

namespace Talan\VpnBundle\Entity;

use FR3D\LdapBundle\Model\LdapUserInterface;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="fos_user")
 */
class User extends BaseUser implements LdapUserInterface
{

    /**
   * @var integer $id
   *
   * @ORM\Column(name="id", type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;
/**
   * Ldap Object Distinguished Name
   * @var string $dn
   */
  protected $dn;
  /**
   * Get id
   *
   * @return integer
   */
  public function getId()
  {
      return $this->id;
  }



    public function __construct()
    {
        parent::__construct();
        // your own logic


    }

    /**
     * {@inheritDoc}
     */
    public function getDn() {
      return $this->dn;  
    }


    /**
     * {@inheritDoc}
     */
    public function setDn($dn) {
        $this->dn = $dn;
    }

}

from fr3dldapbundle.

Maks3w avatar Maks3w commented on September 6, 2024

username should be the full DN or just the username value

from fr3dldapbundle.

symfony24 avatar symfony24 commented on September 6, 2024

great authentication work fine thx to this topic #10
, now i need to manage authorization
For example,
if the user exists within the LDAP group named "Admin", the provided LdapUser object will have the "ROLE_LDAP_ADMIN" role.
what shall i do ?

from fr3dldapbundle.

Maks3w avatar Maks3w commented on September 6, 2024

At this moment I don't provide support for roles but seems that @jkostrz applied a patch for it https://github.com/jkostrz/FR3DLdapBundle

from fr3dldapbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.