Your config seems to be fine. I would first make sure that both of supports() are actually reached and executed.
On Thu, Feb 27, 2014 at 9:47 PM, Brian Demers <[email protected]>wrote: > Is the first realm in your list throwing an exception? > > > On Wed, Feb 26, 2014 at 6:20 PM, [email protected] < > [email protected]> wrote: > >> I thought I had corrected this when I changed the order of my Realms in >> the realm property, but it is back. >> >> "org.apache.shiro.authc.AuthenticationException: Authentication token of >> type [class org.apache.shiro.authc.UsernamePasswordToken] could not be >> authenticated by any configured realms. Please ensure that at least one >> realm can authenticate these tokens." >> >> >> This would mean that it couldn't find one of my realms that returns true >> for supporting UsernamePasswordToken. But it is 100% wrong. The second >> realm in my configuration accepts exactly just that type. >> >> What am I doing wrong? >> >> <bean id="hdPokerFingerprintRealm" >> class="com.hdpoker.security.shiro.realm.HDPokerFingerprintRealm"> >> <property name="name" value="hdPokerFingerprint"/> >> <property name="credentialsMatcher"> >> <bean >> class="org.apache.shiro.authc.credential.SimpleCredentialsMatcher"/> >> </property> >> <property name="authenticationCachingEnabled" value="true"/> >> </bean> >> >> <!-- Define the realm you want to use to connect to your back-end >> security datasource: --> >> <bean id="hdPokerRealm" >> class="com.hdpoker.security.shiro.realm.HDPokerRealm"> >> <property name="name" value="hdPoker"/> >> <property name="credentialsMatcher" ref="credentialsMatcher"/> >> <!--<property name="cacheManager" ref="cacheManager"/>--> >> <property name="authenticationCachingEnabled" value="false"/> >> </bean> >> >> <bean id="credentialsMatcher" >> class="org.apache.shiro.authc.credential.PasswordMatcher"> >> <property name="passwordService" ref="passwordService"/> >> </bean> >> >> <bean id="securityManager" >> class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> >> <!-- Single realm app. If you have multiple realms, use the >> 'realms' property instead. --> >> <!--<property name="realm" ref="hdPokerRealm"/>--> >> <property name="realms"> >> <list> >> <ref bean="hdPokerRealm"/> >> <ref bean="hdPokerFingerprintRealm"/> >> </list> >> </property> >> <!--<property name="cacheManager" ref="cacheManager"/>--> >> <property name="sessionManager" ref="sessionManager"/> >> </bean> >> >> >> In HDPokerFingerprintRealm we have >> >> @Override >> public boolean supports(AuthenticationToken authenticationToken) { >> return (authenticationToken instanceof FingerPrintAuthenticationToken) >> } >> >> >> In HDPokerRealm we have >> >> @Override >> public boolean supports(AuthenticationToken authenticationToken) { >> return (authenticationToken instanceof UsernamePasswordToken) >> } >> >> >> Thanks >> >> Mark >> > > -- Do not pursue the past. Do not lose yourself in the future. The past no longer is. The future has not yet come. Looking deeply at life as it is in the very here and now, the practitioner dwells in stability and freedom. (Thich Nhat Hanh)
