OpenLDAP connection fails with error Reason: The elements [cas.authn.ldap[0].userfilter] were left unbound.

58 views
Skip to first unread message

WalTech

unread,
Oct 3, 2019, 12:02:59 PM10/3/19
to CAS Community
I found Apereo's CAS yesterday, so i am learning by failing. 
I try to connect CAS to my OpenLDAP server and created a new application.properties file in /etc/cas/config 

cas.authn.ldap[0].type=AUTHENTICATED
cas.authn.ldap[0].principalAttributeList=sAMAccountName,cn,givenName,memberOf,userPrincipalName,department,title,distinguishedName
cas.authn.ldap[0].ldapUrl=ldap://openldap.lan:10389
cas.authn.ldap[0].bindDn=uid=admin,ou=system
cas.authn.ldap[0].bindCredential=verysecret
cas.authn.ldap[0].useSsl=false
cas.authn.ldap[0].baseDn=o=slaas,ou=Users
cas.authn.ldap[0].userFilter=cn={Users}
cas.authn.ldap[0].subtreeSearch=true
cas.authn.ldap[0].searchFilter=sAMAccountName={user}
cas.authn.ldap[0].enhanceWithEntryResolver=true
cas.authn.ldap[0].dnFormat=uid=%s,o=slaas,ou=Users
cas.authn.ldap[0].enhanceWithEntryResolver=true
cas.authn.ldap[0].dnFormat=uid=%s,ou=Users,o=slaas
cas.authn.ldap[0].followReferrals=false
cas.authn.ldap[0].hostnameVerifier=ANY
When i run my  build.cmd run it halts and fails with the following error:

***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@6e7c351d type = org.apereo.cas.configuration.CasConfigurationProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(value=cas, prefix=cas, ignoreUnknownFields=false, ignoreInvalidFields=false)]] failed:
    Property: cas.authn.ldap[0].userfilter
    Value: cn={user}
    Origin: "cas.authn.ldap[0].userFilter" from property source "bootstrapProperties"
    Reason: The elements [cas.authn.ldap[0].userfilter] were left unbound.
Action:
Update your application's configuration

Is there anyone who can point me in the right direction? 

WalTech

unread,
Oct 3, 2019, 12:06:34 PM10/3/19
to CAS Community
hmmm maybe the error line sthat are printed earlier are more helpfull: 

2019-10-03 18:04:16,088 INFO [org.apereo.cas.configuration.DefaultCasConfigurationPropertiesSourceLocator] - <Configuration files found at [\etc\cas\config] are [[file [C:\etc\cas\config\application.properties], file [C:\etc\cas\config\cas.properties]]] under profile(s) [[standalone]]>
2019-10-03 18:04:16,212 INFO [org.apereo.cas.web.CasWebApplication] - <The following profiles are active: standalone>
2019-10-03 18:04:16,480 DEBUG [org.apereo.cas.web.CasWebApplicationContext] - <Refreshing org.apereo.cas.web.CasWebApplicationContext@120f38e6>
2019-10-03 18:04:19,705 WARN [org.apereo.cas.web.CasWebApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casBeanValidationPostProcessor' defined in class path resource [org/apereo/cas/config/CasCoreUtilConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'casCoreTicketsConfiguration': Unsatisfied dependency expressed through field 'casProperties'; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'cas-org.apereo.cas.configuration.CasConfigurationProperties': Could not bind properties to 'CasConfigurationProperties' : prefix=cas, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'cas' to org.apereo.cas.configuration.CasConfigurationProperties>
2019-10-03 18:04:19,741 ERROR [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter]

Ray Bon

unread,
Oct 3, 2019, 2:12:59 PM10/3/19
to cas-...@apereo.org
Which version are you using?
I think in 6, userFilter changed to searchFilter. But I do not see it listed in the docs.


Ray
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.

WalTech

unread,
Oct 3, 2019, 2:28:39 PM10/3/19
to CAS Community
Yes i do use version 6 (CAS overlay template master) downloaded yesterday from git. 

I tried several settings and with and without the userfilter, but it keeps on throwing the same error. 
#cas.authn.ldap[0].userFilter=sAMAccountName={user}
cas.authn.ldap[0].searchFilter=sAMAccountName={user}

and 
cas.authn.ldap[0].userFilter=sAMAccountName={user}
#cas.authn.ldap[0].searchFilter=sAMAccountName={user}

which makes me believe that the application.properties isn't even read 

Ray Bon

unread,
Oct 3, 2019, 3:04:39 PM10/3/19
to cas-...@apereo.org

WalTech

unread,
Oct 3, 2019, 3:23:56 PM10/3/19
to CAS Community
I think something goes wrong during the build. 
When i do gradlew clean copyCasConfiguration build it clears my application.properties and my cas.properties completely.
but it won't build a war that contains my settings 

WalTech

unread,
Oct 3, 2019, 3:27:26 PM10/3/19
to CAS Community
My cas.properties: 
cas.server.prefix=${cas.server.name}/cas

logging.config: file:/etc/cas/config/log4j2.xml

cas.authn.accept.users=
logging.level.org.apereo=DEBUG


cas.authn.ldap[0].ldapUrl=ldaps://cent-prod1.lan:10389
cas.authn.ldap[0].bindDn=cn=uid=admin,ou=system,dc=example,dc=org
cas.authn.ldap[0].bindCredential=sssss

cas.authn.ldap[0].poolPassivator=BIND
cas.authn.ldap[0].connectionStrategy=
cas.authn.ldap[0].providerClass=org.ldaptive.provider.unboundid.UnboundIDProvider
cas.authn.ldap[0].searchFilter=sAMAccountName={user}
cas.authn.ldap[0].connectTimeout=PT5S
cas.authn.ldap[0].trustCertificates=
cas.authn.ldap[0].keystore=
cas.authn.ldap[0].keystorePassword=
cas.authn.ldap[0].keystoreType=JKS|JCEKS|PKCS12
cas.authn.ldap[0].minPoolSize=3
cas.authn.ldap[0].maxPoolSize=10
cas.authn.ldap[0].validateOnCheckout=true
cas.authn.ldap[0].validatePeriodically=true
cas.authn.ldap[0].validatePeriod=PT5M
cas.authn.ldap[0].validateTimeout=PT5S
cas.authn.ldap[0].failFast=true
cas.authn.ldap[0].idleTime=PT10M
cas.authn.ldap[0].prunePeriod=PT2H
cas.authn.ldap[0].blockWaitTime=PT3S
cas.authn.ldap[0].useSsl=true
cas.authn.ldap[0].useStartTls=false
cas.authn.ldap[0].responseTimeout=PT5S
cas.authn.ldap[0].allowMultipleDns=false
cas.authn.ldap[0].allowMultipleEntries=false
cas.authn.ldap[0].followReferrals=false
cas.authn.ldap[0].binaryAttributes=objectGUID,someOtherAttribute
cas.authn.ldap[0].name=
when doing "gradlew run --debug"  it results in:
21:24:53.467 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :run
21:24:57.908 [QUIET] [system.out] 2019-10-03 21:24:57,907 WARN [org.apereo.cas.web.CasWebApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casBeanValidationPostProcessor' defined in class path resource [org/apereo/cas/config/CasCoreUtilConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'casCoreTicketsConfiguration': Unsatisfied dependency expressed through field 'casProperties'; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'cas-org.apereo.cas.configuration.CasConfigurationProperties': Could not bind properties to 'CasConfigurationProperties' : prefix=cas, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'cas' to org.apereo.cas.configuration.CasConfigurationProperties>
21:24:57.947 [QUIET] [system.out] 2019-10-03 21:24:57,948 ERROR [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] - <
21:24:57.947 [QUIET] [system.out]
21:24:57.947 [QUIET] [system.out] ***************************
21:24:57.947 [QUIET] [system.out] APPLICATION FAILED TO START
21:24:57.947 [QUIET] [system.out] ***************************
21:24:57.947 [QUIET] [system.out]
21:24:57.948 [QUIET] [system.out] Description:
21:24:57.948 [QUIET] [system.out]
21:24:57.948 [QUIET] [system.out] Binding to target [Bindable@19a64eae type = org.apereo.cas.configuration.CasConfigurationProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(value=cas, prefix=cas, ignoreInvalidFields=false, ignoreUnknownFields=false)]] failed:
21:24:57.948 [QUIET] [system.out]
21:24:57.948 [QUIET] [system.out]     Property: cas.authn.ldap[0].userfilter
21:24:57.948 [QUIET] [system.out]     Value: cn={user}
21:24:57.948 [QUIET] [system.out]     Origin: "cas.authn.ldap[0].userFilter" from property source "bootstrapProperties"
21:24:57.948 [QUIET] [system.out]     Reason: The elements [cas.authn.ldap[0].userfilter] were left unbound.
21:24:57.948 [QUIET] [system.out]
21:24:57.948 [QUIET] [system.out] Action:
21:24:57.948 [QUIET] [system.out]
21:24:57.948 [QUIET] [system.out] Update your application's configuration
21:24:57.948 [QUIET] [system.out] >
21:24:58.020 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
 

WalTech

unread,
Oct 3, 2019, 3:32:29 PM10/3/19
to CAS Community
OH MY FREAKING *********** !!

I am so stupid!

I am working on windows and i made all modifications to the etc\cas\config directory in the downloaded git source. 
But it seems that the tests of yesterday evening created a c:\etc\cas\config directory and there was my application.properties file with still cas.authn.ldap[0].userFilter=cn={user} inside. 
So i removed that line from the file and now it is running !
Reply all
Reply to author
Forward
0 new messages