[
https://issues.apache.org/jira/browse/SHIRO-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756703#action_12756703
]
Kalle Korhonen commented on SHIRO-96:
-------------------------------------
Took some time to debug this but couldn't get to the bottom of it. Have to move
on for now, but it worries me and I'll have to come back to it some other time.
I'll just update the issue with what I know. First of all, discovering tag libs
doesn't seem to work correctly when the classes are not in jars (could be
Eclipse specific problem). To be able to run in IDE and modify on the fly, I
copied shiro.tld to to samples-web's src/main/webapp/WEB-INF and added:
<taglib>
<taglib-uri>http://shiro.apache.org/tags</taglib-uri>
<taglib-location>/WEB-INF/shiro.tld</taglib-location>
</taglib>
to its web.xml.
Either test randomly fails, more often in when running "slowly" with a debugger
attached. It doesn't seem to be any of the the low level cache objects - I made
them final one by one and returned pre-constructed map and it didn't make a
difference. if (value != null) on line 150 of SoftHashMap returns false when
it won't work, indicating that two caches are initialized. However, log output
for both a successful and a failing run are equal - up to a point where it
fails with:
[org.apache.shiro.authc.AbstractAuthenticator]: Authentication attempt received
for token [org.apache.shiro.authc.UsernamePasswordToken - root,
rememberMe=false (/127.0.0.1)]
[org.apache.shiro.realm.AuthenticatingRealm]: No authentication information
found for submitted authentication token
[org.apache.shiro.authc.UsernamePasswordToken - root, rememberMe=false
(/127.0.0.1)]. Returning null. A cache is populated in both cases.
Technically, it could be the container initialization as well since mvn
jetty:run never seems to fail the same way, but I tried several options without
any significant difference.
> Add meaningful integration tests to assert key web functionality
> ----------------------------------------------------------------
>
> Key: SHIRO-96
> URL: https://issues.apache.org/jira/browse/SHIRO-96
> Project: Shiro
> Issue Type: Test
> Components: Authentication (log-in)
> Affects Versions: 1.0
> Environment: any
> Reporter: Kalle Korhonen
> Fix For: 1.0
>
> Attachments: integration-tests.patch
>
>
> Related to SHIRO-93 (but you closed it already - could have re-opened as
> well). Assert login/logout and remember me functionality. Also updating
> htmlunit to newly released 2.6. Note that tests revealed an interesting
> thread-safety issue: sometimes
> getAuthorizationCache().get(upToken.getUsername()); on line 141 of
> SimpleAccountRealm returned null, causing the authentication to fail. It
> happened much frequently when I was running the test via Eclipse, but
> couldn't get it to run when running via Maven. I took an initial look at the
> CacheManager and didn't follow through completely, but it looked like that a
> map initialization somewhere may not have been synchronized. Note that these
> tests run considerably faster than if a human was using a browser but
> otherwise they don't semantically do anything else different. A patch to
> follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.