Note that there are some explanatory texts on larger screens.

plurals
  1. POapache shiro: how to set the authenticationStrategy using spring applicationcontext?
    primarykey
    data
    text
    <p>I've been struggling with authenticationStrategy settings with shiro 1.2.1 in a spring based web application. I have 2 realms. One authenticates against <code>database</code> and one against ldap. both <code>realms</code> are working fine just that i wanted a <code>FirstSuccessfulStrategy</code> but it seems both realms are still being called. here is my security-application-context:</p> <pre><code>&lt;bean id="passwordService" class="org.apache.shiro.authc.credential.DefaultPasswordService"&gt; &lt;property name="hashService" ref="hashService" /&gt; &lt;/bean&gt; &lt;bean id="hashService" class="org.apache.shiro.crypto.hash.DefaultHashService"&gt; &lt;property name="hashAlgorithmName" value="SHA-512" /&gt; &lt;property name="hashIterations" value="500000" /&gt; &lt;/bean&gt; &lt;bean id="SaltedSha512JPARealm" class="bla.bla.webapp.security.SaltedSha512JPARealm"&gt; &lt;property name="credentialsMatcher"&gt; &lt;bean class="org.apache.shiro.authc.credential.PasswordMatcher"&gt; &lt;property name="passwordService" ref="passwordService"/&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="ldapContextFactory" class="org.apache.shiro.realm.ldap.JndiLdapContextFactory"&gt; &lt;property name="url" value="${user.ldap.connection.url}"/&gt; &lt;property name="authenticationMechanism" value="${user.ldap.connection.auth_mecanism}"/&gt; &lt;/bean&gt; &lt;bean id="ldapRealm" class="bla.bla.webapp.security.LDAPRealm"&gt; &lt;property name="userDnTemplate" value="${user.ldap.connection.userDnTemplate}"/&gt; &lt;property name="contextFactory" ref="ldapContextFactory" /&gt; &lt;/bean&gt; &lt;bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager" depends-on="roleRepository,roleRightRepository,rightRepository,userRepository"&gt; &lt;property name="realms"&gt; &lt;list&gt; &lt;ref local="ldapRealm"/&gt; &lt;ref local="SaltedSha512JPARealm"/&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="authenticator.authenticationStrategy"&gt; &lt;bean class="org.apache.shiro.authc.pam.FirstSuccessfulStrategy"/&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>is there anything there that i am not doing well?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload