org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

chandragaajula
I'm using the "Mock authentication support for Spring Security" with the following configuration:

Grails 2.3.2
JDK 1.6
spring-security-core:1.2.7.3
spring-security-mock:1.0.3

My Config.groovy has the following entries ->

grails.plugins.springsecurity.providerNames = [
        'anonymousAuthenticationProvider',
        'rememberMeAuthenticationProvider',
        'daoAuthenticationProvider',
        'ldapAuthProvider']

grails.plugins.springsecurity.ldap.active = false
grails.plugins.springsecurity.ldap.authorities.retrieveGroupRoles = false
grails.plugins.springsecurity.ldap.usernameMapper.userDnBase = false

//Configuration changes to accommodate plugin for mocking spring security
grails.plugins.springsecurity.mock.active = true
grails.plugins.springsecurity.mock.fullName = 'User A'
grails.plugins.springsecurity.mock.email = 'user_a@gmail.com'
grails.plugins.springsecurity.mock.username = 'user_a'
grails.plugins.springsecurity.mock.roles = ['ROLE_USER', 'ROLE_ADMIN']
grails.plugins.springsecurity.mock.load.dao = false

However, when I run my Integration Test (extends spock.lang.Specification) I get the following Error ->
Fatal error running tests: No bean named 'ldapAuthProvider' is defined (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined



What am I missing?
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

burtbeckwith
You're missing the LDAP plugin: http://grails.org/plugin/spring-security-ldap

Burt

chandragaajula wrote
I'm using the "Mock authentication support for Spring Security" with the following configuration:

Grails 2.3.2
JDK 1.6
spring-security-core:1.2.7.3
spring-security-mock:1.0.3

My Config.groovy has the following entries ->

grails.plugins.springsecurity.providerNames = [
        'anonymousAuthenticationProvider',
        'rememberMeAuthenticationProvider',
        'daoAuthenticationProvider',
        'ldapAuthProvider']

grails.plugins.springsecurity.ldap.active = false
grails.plugins.springsecurity.ldap.authorities.retrieveGroupRoles = false
grails.plugins.springsecurity.ldap.usernameMapper.userDnBase = false

//Configuration changes to accommodate plugin for mocking spring security
grails.plugins.springsecurity.mock.active = true
grails.plugins.springsecurity.mock.fullName = 'User A'
grails.plugins.springsecurity.mock.email = 'user_a@gmail.com'
grails.plugins.springsecurity.mock.username = 'user_a'
grails.plugins.springsecurity.mock.roles = ['ROLE_USER', 'ROLE_ADMIN']
grails.plugins.springsecurity.mock.load.dao = false

However, when I run my Integration Test (extends spock.lang.Specification) I get the following Error ->
Fatal error running tests: No bean named 'ldapAuthProvider' is defined (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined



What am I missing?
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

chandragaajula
I did have an entry:

compile ":spring-security-ldap:1.0.6"
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

burtbeckwith
You have it disabled though ( grails.plugins.springsecurity.ldap.active = false ) - no beans are created if the plugin isn't active.

Burt

chandragaajula wrote
I did have an entry:

compile ":spring-security-ldap:1.0.6"
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

chandragaajula
I'm following the plugin documentation (http://zirbes.org/grails-spring-security-mock/docs/guide/configuration.html)

"If all three of these settings are configured and enabled, then the Mock plugin will attempt to load roles from LDAP rather than from the mock.roles configuration setting."

Since I don't want the Mock plugin to attempt to load the roles from LDAP, I have them marked false. Am I on the right track?
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

burtbeckwith
You're reading that a bit too literally. The mock plugin isn't going to magically create all of the missing beans and add all of the missing configuration that didn't happen if one or more of the plugins were disabled.

Burt

chandragaajula wrote
I'm following the plugin documentation (http://zirbes.org/grails-spring-security-mock/docs/guide/configuration.html)

"If all three of these settings are configured and enabled, then the Mock plugin will attempt to load roles from LDAP rather than from the mock.roles configuration setting."

Since I don't want the Mock plugin to attempt to load the roles from LDAP, I have them marked false. Am I on the right track?
Reply | Threaded
Open this post in threaded view
|

Re: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ldapAuthProvider' is defined

chandragaajula
I removed the entries that disables the grails.plugins.springsecurity.ldap entries. I get the following now:



java.lang.IllegalStateException: Cannot activate transaction synchronization - already active
        at grails.test.mixin.integration.IntegrationTestMixin.initIntegrationTest(IntegrationTestMixin.groovy:57)
        at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
        at org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension$FixtureType$FixtureMethodInterceptor.intercept(JUnitFixtureMethodsExtension.java:145)
        at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
        at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
        at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
        at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)