I had the same problem ... my solution is not perfect:
the browser sends the so-called referent to one of the headers, which you can go through
request?.getHeader('Referer')
But a referrer is something you can really rely on, but most browsers send it.
Another solution might be a filter: try writing the current url to another variable before you call accessControl()in ShiroSecurityFilters.groovy. You can get the current url via request.forwardURI.
Update: just confirmed my last assumption - this seems like the cleanest solution for me:
In ShiroSecurityFilters.groovyreplace
// Access control by convention.
accessControl()
with
// Access control by convention.
if (!accessControl()) {
session.deniedUrl = request.forwardURI
return false
}
URL- session.deniedUrl / .