Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mock not working with spring-security-core 2.0 RC2 and ldap 2.0 RC2 #10

Open
GAHila opened this issue Apr 15, 2014 · 0 comments
Open

mock not working with spring-security-core 2.0 RC2 and ldap 2.0 RC2 #10

GAHila opened this issue Apr 15, 2014 · 0 comments

Comments

@GAHila
Copy link

GAHila commented Apr 15, 2014

I have the following config in Config.groovy:

// LDAP config
grails.plugin.springsecurity.providerNames = ['ldapAuthProvider', 'anonymousAuthenticationProvider'] // specify this when you want to skip attempting to load from db and only use LDAP
grails.plugin.springsecurity.ldap.context.managerDn = 'CN=someuser,OU=Development,OU=Staff,DC=subdomain,DC=domain,DC=com'
grails.plugin.springsecurity.ldap.context.managerPassword = 'somepassword'
grails.plugin.springsecurity.ldap.context.server = 'ldap://subdomaindc01.subdomain.domain.com:389 ldap://subdomaindc02.subdomain.domain.com:389'
grails.plugin.springsecurity.ldap.authorities.ignorePartialResultException = true // typically needed for Active Directory
grails.plugin.springsecurity.ldap.search.filter = '(&(objectclass=user)(sAMAccountName={0})(memberOf=cn=Comms-Team,ou=groups,ou=staff,dc=subdomain,dc=domain,dc=com))' // for Active Directory you need this
grails.plugin.springsecurity.ldap.search.searchSubtree = true
grails.plugin.springsecurity.ldap.auth.hideUserNotFoundExceptions = false
grails.plugin.springsecurity.ldap.search.attributesToReturn = ['mail', 'displayName'] // extra attributes you want returned; see below for custom classes that access this data
//grails.plugin.springsecurity.ldap.search.base = 'ou=staff,dc=subdomain,dc=domain,dc=com'

development {
grails.plugin.springsecurity.ldap.search.base = 'ou=staff,dc=subdomain,dc=domain,dc=com'
}

production {
grails.plugin.springsecurity.ldap.search.base = 'ou=staff,dc=subdomain,dc=domain,dc=com'
}

test {
grails.plugin.springsecurity.providerNames = null
grails.plugin.springsecurity.mock.active = true
grails.plugin.springsecurity.ldap.active = false
grails.plugin.springsecurity.mock.fullName = "Test User"
grails.plugin.springsecurity.mock.email = "[email protected]"
grails.plugin.springsecurity.mock.username = "testUser"
}

// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.userLookup.userDomainClassName = 'com.app.login.User'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'com.app.login.UserRole'
grails.plugin.springsecurity.authority.className = 'com.app.login.Role'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/': ['IS_AUTHENTICATED_FULLY'],
'/index': ['IS_AUTHENTICATED_FULLY'],
'/index.gsp': ['IS_AUTHENTICATED_FULLY'],
'//js/': ['permitAll'],
'//css/': ['permitAll'],
'//images/': ['permitAll'],
'/**/favicon.ico': ['permitAll']
]

Also the following in the BuildConfig.groovy:

compile ":spring-security-core:2.0-RC2"
compile ":spring-security-ldap:2.0-RC2"
compile ":spring-security-mock:2.0-RC2"

    provided ":spring-security-mock:1.0.1"

Grails is 2.3.7.

When I remove test environment configuration above everything works fine but once I add that in trying to access localhost:8080/app - which ends up in the index.gsp page - I don't get anymore the login page - but instead:

HTTP Status 401 - Full authentication is required to access this resource

However, when I use localhost:8080/app//login/auth it brings up the login page but login keeps failing at this point.

All of this is under dev environment so mock should not even be affecting this but somehow it is and I have no idea how it is affecting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant