Announcement Announcement Module
Collapse
No announcement yet.
@Service is not @Injected for custom written authentication-provider Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @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
    No ideas? Does nobody use custom authentication provider? Did it work for you?

    Thanks.

    Comment


    • #3
      Why do you need @Service for your authentication provider?

      Comment


      • #4
        FYI This was solved on another thread See http://forum.springsource.org/showth...a-regular-bean

        Comment

        Working...
        X