I am trying to setup SSO with spring security SAML (spring security 4.0.1 and saml 1.0.1) but on startup I get the following error:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.security.saml.log.SAMLLogger] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1320)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:961)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:616)
... 91 more
Here is my context:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd">
...
<security:http pattern="/saml/**" create-session="stateless" entry-point-ref="samlEntryPoint">
<security:intercept-url pattern="/**" access="hasRole('ROLE_RUN')" />
<security:custom-filter before="FIRST" ref="metadataGeneratorFilter"/>
<security:custom-filter after="BASIC_AUTH_FILTER" ref="samlFilter"/>
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="admin" password="!@#$torch" authorities="ROLE_ADMIN" />
</security:user-service>
</security:authentication-provider>
<security:authentication-provider ref="samlAuthenticationProvider" />
</security:authentication-manager>
<context:annotation-config/>
<context:component-scan base-package="org.springframework.security.saml"/>
<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager">
<constructor-arg value="classpath:saml/samlKeystore.jks"/>
<constructor-arg type="java.lang.String" value="torch1234"/>
<constructor-arg>
<map>
<entry key="torchlms" value="torch1234"/>
</map>
</constructor-arg>
<constructor-arg type="java.lang.String" value="torchlms"/>
</bean>
<bean id="samlAuthenticationProvider" class="org.springframework.security.saml.SAMLAuthenticationProvider">
<property name="userDetails" ref="samlUserDetailsServiceImpl" />
<property name="forcePrincipalAsString" value="false" />
</bean>
<bean id="samlUserDetailsServiceImpl" class="com.prometheus.torchlms.security.saml.SAMLUserDetailsServiceImpl">
<constructor-arg ref="authorizationService" />
<constructor-arg ref="principalHolderService" />
</bean>
...
The error makes me think it is missing the component scan, but I added that. The only thing I can think of is its something wrong with the way I defined my context namespace, but that looks right to me too. Thoughts?
The secret to figure all this stuff out is to look at the sample apps context files and paste in everything, then remove the stuff you don't need. There is a ton of stuff in the sample app that isn't mentioned in the docs. I was able to get it working with that approach.