Yes,
My security, is :
security:
    encoders:
        #Symfony\Component\Security\Core\User\User: plaintext
        Infocasas\PublicBundle\Entity\SwapUser:
          algorithm: md5
          encode-as-base64: true
          iterations: 10

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        main:
            entity: { class: InfocasasPublic:SwapUser, property: username }

        in_memory:
            users:
                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }

    firewalls:
        main:
          pattern: .*
          form_login:
              check_path: /login_check
              login_path: /login
          logout: true
          security: true
          anonymous: true


        profiler:
            pattern:  ^/_profiler
            security: false

        wdt:
            pattern:  ^/_wdt
            security: false

        login:
            pattern:  ^/demo/secured/login$
            security: false

        secured_area:
            pattern:    ^/demo/secured/
            form_login:
                check_path: /demo/secured/login_check
                login_path: /demo/secured/login
            logout:
                path:   /demo/secured/logout
                target: /demo/
            #anonymous: ~
            #http_basic:
            #    realm: "Secured Demo Area"

    access_control:
        #- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY,
requires_channel: https }
        - { path: /admin/.*, role: ROLE_USER }
        - { path: /.*, role: IS_AUTHENTICATED_ANONYMOUSLY }

But, how i can to make the var_dump to mine provider?

That's a var_dump of the token into AbstractToken:


object(Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken)#198
(6) {
["credentials":"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":private]=>
NULL
["providerKey":"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":private]=>
string(4) "main"
["user":"Symfony\Component\Security\Core\Authentication\Token\AbstractToken":private]=>
string(3) "ats"
["roles":"Symfony\Component\Security\Core\Authentication\Token\AbstractToken":private]=>
array(0) { }
["authenticated":"Symfony\Component\Security\Core\Authentication\Token\AbstractToken":private]=>
bool(false)
["attributes":"Symfony\Component\Security\Core\Authentication\Token\AbstractToken":private]=>
array(0) { } }






2011/4/8 Gustavo Adrian <comfortablynum...@gmail.com>

> Can you show us your security config? and try tu var_dump what entity is
> your provider returning
>
> 2011/4/8 kassel <alvaro.tou...@gmail.com>
>
>> Hi Gustavo.
>> I've use the ROLE_ADMON as default value for it
>> code from Entity:
>> public function getRoles(){
>>        return array("ROLE_USER");
>>    }
>>
>> And nothing the same point of exception, and same value of $this-
>> >getCredentials()==NULL
>>
>> Waht i made wraon,  my code is basic, only uses an entity for
>> validate, into logs i've saw that make an query to BD with username
>>
>> Thanks
>>
>>
>> On Apr 8, 8:16 pm, Gustavo Adrian <comfortablynum...@gmail.com> wrote:
>> > One thing I've noticed. Your role is ADMON. If your roles are defined as
>> > strings, they should have the "ROLE_" prefix as stated here:
>> >
>> > http://symfony.com/doc/2.0/book/security/users.html#roles
>> >
>> > <http://symfony.com/doc/2.0/book/security/users.html#roles>So your role
>> > should be ROLE_ADMON
>> >
>> > 2011/4/8 kassel <alvaro.tou...@gmail.com>
>> >
>> > > Hi, i founded the exception
>> > > its here:
>> >
>> > > if (!$presentedPassword = $token->getCredentials()) {
>> > >                throw new
>> > > BadCredentialsException($presentedPassword.'Bad credentials est!?='.
>> > > $token->getCredentials()." MODR ");
>> > >            }
>> > > if i try to draw the value, it's NULL
>> > > What i make bad?
>> > > thnks
>> >
>> > > On Apr 8, 12:50 pm, kassel <alvaro.tou...@gmail.com> wrote:
>> > > > Hi every, i'm using the same tuto, and gives an
>> > > > "AuthenticationServiceException", and when i look at the bootom saw
>> > > > i'm  authenticated by anonymous, and got not Roles.
>> > > > My Global user Class implements UserInterface
>> > > > and it this:
>> >
>> > > > <?php
>> >
>> > > > namespace Callcenter\PrivateBundle\Entity;
>> >
>> > > > use Symfony\Component\Security\Core\User\UserInterface;
>> >
>> > > > /**
>> > > >  * Callcenter\PrivateBundle\Entity\GlobalUser
>> > > >  *
>> > > >  * @orm:Table(name="global_user")
>> > > >  * @orm:Entity
>> > > >  */
>> > > > class GlobalUser implements UserInterface
>> > > > {
>> > > >     protected $userRoles=array("ADMON");
>> > > >     /**
>> > > >      * @var integer $id
>> > > >      *
>> > > >      * @orm:Column(name="id", type="integer", nullable=false)
>> > > >      * @orm:Id
>> > > >      * @orm:GeneratedValue(strategy="IDENTITY")
>> > > >      */
>> > > >     private $id;
>> >
>> > > >     /**
>> > > >      * @var string $name
>> > > >      *
>> > > >      * @orm:Column(name="name", type="string", length=25,
>> > > > nullable=false)
>> > > >      */
>> > > >     private $username;
>> >
>> > > >     /**
>> > > >      * @var string $pwd
>> > > >      *
>> > > >      * @orm:Column(name="pwd", type="string", length=25,
>> > > > nullable=false)
>> > > >      */
>> > > >     private $password;
>> >
>> > > >     /**
>> > > >      * @var string $hash
>> > > >      *
>> > > >      * @orm:Column(name="hash", type="string", length=45,
>> > > > nullable=false)
>> > > >      */
>> > > >     private $hash;
>> >
>> > > >     /**
>> > > >      * @var string $type
>> > > >      *
>> > > >      * @orm:Column(name="type", type="string", length=5,
>> > > > nullable=false)
>> > > >      */
>> > > >     private $type;
>> >
>> > > >     /**
>> > > >      * @var datetime $createdAt
>> > > >      *
>> > > >      * @orm:Column(name="created_at", type="datetime",
>> nullable=false)
>> > > >      */
>> > > >     private $createdAt;
>> >
>> > > >     /**
>> > > >      * @var datetime $updatedAt
>> > > >      *
>> > > >      * @orm:Column(name="updated_at", type="datetime",
>> nullable=false)
>> > > >      */
>> > > >     private $updatedAt;
>> >
>> > > >     /**
>> > > >      * @var integer $active
>> > > >      *
>> > > >      * @orm:Column(name="active", type="integer", nullable=false)
>> > > >      */
>> > > >     private $active;
>> >
>> > > >     /**
>> > > >      * Get id
>> > > >      *
>> > > >      * @return integer $id
>> > > >      */
>> > > >     public function getId()
>> > > >     {
>> > > >         return $this->id;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Set name
>> > > >      *
>> > > >      * @param string $name
>> > > >      */
>> > > >     /*public function setName($name)
>> > > >     {
>> > > >         $this->name = $name;
>> > > >     }*/
>> >
>> > > >     /**
>> > > >      * Get name
>> > > >      *
>> > > >      * @return string $name
>> > > >      */
>> > > >     /*public function getName()
>> > > >     {
>> > > >         return $this->name;
>> > > >     }*/
>> >
>> > > >     /**
>> > > >      * Set pwd
>> > > >      *
>> > > >      * @param string $pwd
>> > > >      */
>> > > >    /* public function setPwd($pwd)
>> > > >     {
>> > > >         $this->pwd = $pwd;
>> > > >     }*/
>> >
>> > > >     /**
>> > > >      * Get pwd
>> > > >      *
>> > > >      * @return string $pwd
>> > > >      */
>> > > >     /*public function getPwd()
>> > > >     {
>> > > >         return $this->pwd;
>> > > >     }*/
>> >
>> > > >     /**
>> > > >      * Set hash
>> > > >      *
>> > > >      * @param string $hash
>> > > >      */
>> > > >     public function setHash($hash)
>> > > >     {
>> > > >         $this->hash = $hash;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Get hash
>> > > >      *
>> > > >      * @return string $hash
>> > > >      */
>> > > >     public function getHash()
>> > > >     {
>> > > >         return $this->hash;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Set type
>> > > >      *
>> > > >      * @param string $type
>> > > >      */
>> > > >     public function setType($type)
>> > > >     {
>> > > >         $this->type = $type;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Get type
>> > > >      *
>> > > >      * @return string $type
>> > > >      */
>> > > >     public function getType()
>> > > >     {
>> > > >         return $this->type;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Set createdAt
>> > > >      *
>> > > >      * @param datetime $createdAt
>> > > >      */
>> > > >     public function setCreatedAt($createdAt)
>> > > >     {
>> > > >         $this->createdAt = $createdAt;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Get createdAt
>> > > >      *
>> > > >      * @return datetime $createdAt
>> > > >      */
>> > > >     public function getCreatedAt()
>> > > >     {
>> > > >         return $this->createdAt;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Set updatedAt
>> > > >      *
>> > > >      * @param datetime $updatedAt
>> > > >      */
>> > > >     public function setUpdatedAt($updatedAt)
>> > > >     {
>> > > >         $this->updatedAt = $updatedAt;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Get updatedAt
>> > > >      *
>> > > >      * @return datetime $updatedAt
>> > > >      */
>> > > >     public function getUpdatedAt()
>> > > >     {
>> > > >         return $this->updatedAt;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Set active
>> > > >      *
>> > > >      * @param integer $active
>> > > >      */
>> > > >     public function setActive($active)
>> > > >     {
>> > > >         $this->active = $active;
>> > > >     }
>> >
>> > > >     /**
>> > > >      * Get active
>> > > >      *
>> > > >      * @return integer $active
>> > > >      */
>> > > >     public function getActive()
>> > > >     {
>> > > >         return $this->active;
>> > > >     }
>> >
>> > > >     public function  setUsername($username) {
>> > > >         $this->name=$username;
>> > > >     }
>> > > >     public function  setPassword($password) {
>> > > >         $this->pwd=$password;
>> > > >     }
>> > > >     public function getRoles(){
>> > > >         return array("ADMON");
>> > > >     }
>> > > >     public function getPassword(){
>> > > >         return $this->password;
>> > > >     }
>> > > >     public function getSalt(){
>> > > >         return $this->type;
>> > > >     }
>> > > >     public function getUsername(){
>> > > >         return $this->username;
>> > > >     }
>> > > >     public function eraseCredentials(){
>> >
>> > > >     }
>> > > >     public function equals(UserInterface $user){
>> > > >         return \md5($this->getUsername()) ==
>> md5($user->getUsername());
>> >
>> > > >     }
>> >
>> > > > }
>> >
>> > > > Why gives that exception???
>> > > > exception 'Symfony\Component\Security\Core\Exception
>> > > > \AuthenticationServiceException' with message 'The user provider
>> must
>> > > > return an UserInterface object.' in C:\xampp\htdocs\heineken\vendor
>> > > > \symfony\src\Symfony\Component\Security\Core\Authentication\Provider
>> > > > \DaoAuthenticationProvider.php:93
>> >
>> > > > Sure i'm nearly to make it's run but i can't untill knows anymore,
>> so
>> > > > could you give some ligth about
>> >
>> > > > THNKS
>> >
>> > > > On 8 abr, 10:47, smontes <smpedre...@gmail.com> wrote:
>> >
>> > > > > sorry sorry, I beginning :) and I thought my message had not been
>> > > > > sent.
>> >
>> > > > > I think that my problem is too with getSalt() because I use
>> > > > > textplain. :P
>> >
>> > > > > On 8 abr, 09:10, smontes <smpedre...@gmail.com> wrote:
>> >
>> > > > > > I send a message yesterday, but I don`t know if you received it.
>> > > Could
>> > > > > > you answer me, please!
>> >
>> > > --
>> > > If you want to report a vulnerability issue on symfony, please send it
>> to
>> > > security at symfony-project.com
>> >
>> > > You received this message because you are subscribed to the Google
>> > > Groups "symfony users" group.
>> > > To post to this group, send email to symfony-users@googlegroups.com
>> > > To unsubscribe from this group, send email to
>> > > symfony-users+unsubscr...@googlegroups.com
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/symfony-users?hl=en
>>
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to symfony-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Álvaro, Senior Web Developer

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to