i'm trying connect spring security application cas server. when login in cas, request redirected webapp in userdetailsservice i'm receiving _cas_stateful_ username , cannot find user in webapp load permissions
the problem authenticationmanager. documentation says, must use casauthenticationprovider this:
<beans:bean id="casauthenticationprovider" class="org.springframework.security.cas.authentication.casauthenticationprovider"> <beans:property name="authenticationuserdetailsservice"> <beans:bean class="org.springframework.security.core.userdetails.userdetailsbynameservicewrapper"> <beans:constructor-arg ref="mongouserdetailsservice" /> </beans:bean> </beans:property> <beans:property name="serviceproperties" ref="serviceproperties" /> <beans:property name="ticketvalidator"> <beans:bean class="org.jasig.cas.client.validation.cas20serviceticketvalidator"> <beans:constructor-arg index="0" value="https://localhost:7443/cas" /> </beans:bean> </beans:property> <!-- esta clave es única por aplicación --> <beans:property name="key" value="your-provider-auth" /> </beans:bean>
then must set casauthenticationprovider authenticationmanager:
<authentication-manager alias="authenticationmanager"> <!-- <authentication-provider user-service-ref='mongouserdetailsservice'/> --> <authentication-provider ref="casauthenticationprovider" /> </authentication-manager>
as can see, custom mongouserdetailsservice not assigned authenticationmanager new casauthenticationprovider, set casauthenticationprovider authenticationmanager