Results 1 to 4 of 4

Thread: @Service is not @Injected for custom written authentication-provider

  1. #1
    Join Date
    Mar 2008
    Posts
    29

    Question @Service is not @Injected for custom written authentication-provider

    I'm writing sample application based on the Greenhouse application.

    Here is the snapshot from security config:
    <authentication-manager>
    <authentication-provider ref="usernamePasswordAuthenticationProvider"/>
    </authentication-manager>
    Here is UsernamePasswordAuthenticationProvider:
    @Service
    public class UsernamePasswordAuthenticationProvider implements AuthenticationProvider {

    @Inject
    private AuthenticationService authenticationService;

    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException { ... }
    ...
    }
    Inside authenticate authenticationService is null.
    However I can obtain authenticationService from the application context if implement ApplicationContextAware, but in this case authenticationService missed authenticationRepository.
    If I try to @Inject authenticationService into any of the @Controller it is injected correctly with authenticationRepository setup.

    All the required <context:component-scan base-package="..."/> are setup correctly in the application.
    Does it work for the Greenhouse application at all (yes, there is @Configuration used instead of xml configuration, does it matter?)?

  2. #2
    Join Date
    Mar 2008
    Posts
    29

    Default

    No ideas? Does nobody use custom authentication provider? Did it work for you?

    Thanks.

  3. #3
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    285

    Default

    Why do you need @Service for your authentication provider?
    Amila Domingo

  4. #4
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    FYI This was solved on another thread See http://forum.springsource.org/showth...a-regular-bean
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

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
  •