To simplify: I need following code
Code:
org.jboss.web.tomcat.security.login.WebAuthentication webAuthentication = new org.jboss.web.tomcat.security.login.WebAuthentication();
boolean result = webAuthentication.login(this.getUserName(), this.getPassword());
to be invoked after sucessfull LdapProvider authentication, and I would like that result influences overall user authentication with spring security (result=true: authentication sucess, result=false: authentication failure).
My spring security configuration:
Code:
<security:http entry-point-ref="authenticationProcessingFilterEntryPoint"
access-decision-manager-ref="httpRequestAccessDecisionManager"
access-denied-page="/j_spring_security_logout">
<security:intercept-url pattern="/faces/login.xhtml*" filters="none" />
<security:intercept-url pattern="/faces/pages/public/**" filters="none" />
<security:intercept-url pattern="/faces/pages/**" access="ROLE_USER,ROLE_REGISTERED,ROLE_FIRMREGISTERED" />
<security:intercept-url pattern="/**" filters="none" />
<security:logout invalidate-session="true" />
</security:http>
<!-- Role-based access. At least one from specified roles must be present to get positive answer -->
<bean id="httpRequestAccessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions" value="false" />
<property name="decisionVoters">
<list>
<ref bean="roleVoterCert"/>
</list>
</property>
</bean>
<bean id="roleVoterCert" class="org.springframework.security.vote.RoleVoter">
<property name="rolePrefix" value="" />
</bean>
<bean id="authenticationProcessingFilter"
class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter">
<security:custom-filter position="AUTHENTICATION_PROCESSING_FILTER" />
<property name="defaultTargetUrl" value="/faces/pages/main/processes.xhtml" />
<property name="authenticationFailureUrl" value="/faces/pages/public/index.xhtml?error" />
<property name="authenticationManager" ref="authenticationManager" />
<property name="alwaysUseDefaultTargetUrl" value="true" />
<property name="usernameParameter" value="j_username" />
<property name="passwordParameter" value="j_password" />
</bean>
<bean id="authenticationProcessingFilterEntryPoint"
class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<property name="loginFormUrl" value="/faces/pages/public/index.xhtml" />
</bean>
<!-- Default namespace configured authentication manager -->
<security:authentication-manager alias="authenticationManager" />
<bean id="ldapAuthProvider"
class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
<security:custom-authentication-provider />
<property name="userDetailsContextMapper" ref="userInfoUserDetailsContextMapper" />
<constructor-arg>
<bean
class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
<constructor-arg ref="defaultLdapContextSource" />
<property name="userSearch">
<bean id="userSearch"
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
<constructor-arg index="0" value="" />
<constructor-arg index="1" value="(uid={0})" />
<constructor-arg index="2" ref="defaultLdapContextSource" />
</bean>
</property>
</bean>
</constructor-arg>
<constructor-arg>
<bean
class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="defaultLdapContextSource" />
<constructor-arg><value>o=roles,dc=app</value></constructor-arg>
<property name="groupRoleAttribute" value="cn" />
<property name="groupSearchFilter" value="(uniqueMember={0})" />
</bean>
</constructor-arg>
</bean>