Results 1 to 4 of 4

Thread: Do the <security:password-encoder> and <security:salt-source> tag also provide beans?

  1. #1
    Join Date
    Jul 2008
    Location
    Maasmechelen (Belgium)
    Posts
    157

    Default Do the <security:password-encoder> and <security:salt-source> tag also provide beans?

    Hi all,

    As there are these tags
    <securityassword-encoder> and <security:salt-source>

    Can I also inject them somewhere in my code?

    As I'm getting an error trying to inject them somewhere to encrypt my passwords:

    "No matching bean of type [org.springframework.security.authentication.encodi ng.PasswordEncoder] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency."

    I guess there aren't any beans created somehow...I solved this by creating the beans and using ref values in their security tags. But what use are they if can't get them in my code somewhere for encrypting passwords?

    Just for decrypting in-xml hardcoded user details? Why not make them available anyways since they aren't very useful since you will most likely need them in your code to encrypt.

    Thanks!

    Jochen

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    I wouldn't recommend you use a SaltSource unless you have a legacy system which requires a separately stored salt. Use a random salt concatenated with the password, as the LdapShaPasswordEncoder does (or the standard password encoder from the new crypto package in 3.1).

    The password-encoder is only really there to inject a bean into the DaoAuthenticationProvider. I would just use a reference as it is more obvious what is going on and the namespace doesn't really save you much.
    Spring - by Pivotal
    twitter @tekul

  3. #3
    Join Date
    Jul 2008
    Location
    Maasmechelen (Belgium)
    Posts
    157

    Thumbs up Thx heaps @ Luke Taylor

    Me and my cholesterol want to thank you a lot for the fast reply!

    I now just use the
    org.springframework.security.crypto.password.Stand ardPasswordEncoder
    instead and dropped the salt!

    Best wishes,

    Jochen

  4. #4
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    Hehe. Yes, I've never been a fan of too much salt myself . My blood pressure is high enough.
    Spring - by Pivotal
    twitter @tekul

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •