We are using Spring/MVC. My SessionDAO logic is:
.....
create(Session session) {
// some random number generation
// save info in DB
((SimpleSession) s).setId
return ssId;
}
readSession(Session sessionId) {
//get record from DB for corresponding sessionId
return ss;
}
... similary update/delete ....
App is launched via login page. (which is loaded after create and few
readsession runs of the code). Spring MVC Controllers accepts user creds
and login user (subject.login(token)). At this point instead of loading the
app.html page (via redirect) it does few more reads and updates and
redirects back to the login page.
Log Output:
15:45:51.565 INFO [mypkg.LoginController] User [newtoshiro] is
authenticated correctly.
15:45:51.581 INFO [mypkg.LoginController] LoginController - CurrentUser
Session [1040] (subject.getSession().getId().toString())
15:45:51.612 INFO [mypkg.SessionDAO] readSession !=null
15:45:51.612 INFO [mypkg.SessionDAO] Called Update Session with session:
1040
15:45:51.628 INFO [mypkg.SessionDAO] updateSession - inside
15:45:51.628 INFO [mypkg.SessionDAO] updateSession - CurrentUser:
[newtoshiro] {(getSubject().getPrincipal()}
15:45:51.628 INFO [mypkg.SessionDAO] updateSession - after user saved
15:45:51.659 INFO [mypkg.LoginController] About to launch Application Page
<!-- User is logged in successfully -->
<!-- App page never loads and goes back to the login page -->
15:45:51.659 DEBUG [org.apache.shiro.web.attr.CookieAttribute] No value
found in request Cookies under cookie name [rememberMe]
15:45:51.659 DEBUG [org.apache.shiro.web.attr.CookieAttribute] Found string
value [1040] from Cookie [JSESSIONID]
15:45:51.706 INFO [mypkg.SessionDAO] readSession !=null
15:45:51.752 INFO [mypkg.SessionDAO] readSession !=null
15:45:51.784 INFO [mypkg.SessionDAO] readSession !=null
15:45:51.830 INFO [mypkg.SessionDAO] readSession !=null
15:45:51.830 INFO [mypkg.SessionDAO] Called Update Session with session:
1040
15:45:51.877 INFO [mypkg.SessionDAO] updateSession - inside
15:45:51.877 INFO [mypkg.SessionDAO] updateSession - CurrentUser: [null]
{getSubject().getPrincipal()}
15:45:51.877 INFO [mypkg.SessionDAO] updateSession - after user saved
15:45:51.940 DEBUG [org.apache.shiro.web.attr.CookieAttribute] No value
found in request Cookies under cookie name [rememberMe]
15:45:51.940 DEBUG [org.apache.shiro.web.attr.CookieAttribute] Found string
value [1040] from Cookie [JSESSIONID]
15:45:51.971 INFO [mypkg.SessionDAO] readSession !=null
15:45:52.018 INFO [mypkg.SessionDAO] readSession !=null
15:45:52.064 INFO [mypkg.SessionDAO] readSession !=null
15:45:52.064 INFO [mypkg.LoginController] Received GET request
15:45:52.111 INFO [mypkg.SessionDAO] readSession !=null
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/Unable-to-implement-create-read-update-session-tp5183219p5183617.html
Sent from the Shiro User mailing list archive at Nabble.com.