Hi Fernando,
With Ini-based web.xml configuration is now handled by the
IniShiroFilter. Are you using the latest trunk snapshot of Shiro?
For example, this works in the Shiro sample webapp:
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>
# INI config here as described in
#
http://incubator.apache.org/shiro/configuration.html#Configuration-INISections
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
You definitely don't want to be creating and unbinding a new
SecurityManager instance for every request - that would be too
expensive. Also, have you checked out the wicket-stuff Shiro
integration project? This handles the pre/post request setup for
wicket-specific applications and should still work. If not, let us
know and maybe we'll have to edit the wicket-stuff project a little.
If I remember correctly, the wicket-stuff guys were just waiting for
Shiro 1.0 to come out to make their Maven integration a little easier.
Let us know if you come across issues and I'll try to jump in and
help out if I can!
Best,
Les
On Tue, Mar 16, 2010 at 1:42 PM, Fernando Wermus
<[email protected]> wrote:
> Hi all,
> I was trying my first step with shiro, without any luck. Despite I set
> up web.xml shiro says that no SecurityManager has been set.
> I decided to add these lines to my code to make SecurityManager
> sessionable....
>
> �...@override protected void onbeginrequest() {
>
> super.onBeginRequest();
>
>
> ThreadContext.bind(new org.apache.shiro.web.DefaultWebSecurityManager(new MyRealm()));
>
> }
>
> �...@override protected void onendrequest() {
>
> super.onEndRequest();
>
> ThreadContext.unbindSecurityManager();
>
> }
>
> Now I get a
>
> java.lang.IllegalStateException: ServletRequest is not available! A
> ServletRequest must be present in either the Subject context map, on an
> existing WebSubject or via the thread context. This exception is probably
> indicative of an erroneous application configuration.
> at
> org.apache.shiro.web.mgt.DefaultWebSubjectFactory.getServletRequest(DefaultWebSubjectFactory.java:67)
> at
> org.apache.shiro.web.mgt.DefaultWebSubjectFactory.getHost(DefaultWebSubjectFactory.java:103)
>
> I suppose that the session is bind in shiroFilter, but It doesnt seem the
> case
> My Shiro Filter....
>
>
> <!-- SHIRO FILTER -->
>
> <filter>
>
> <filter-name>ShiroFilter</filter-name>
>
>
> <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
>
> <init-param>
>
> <param-name>config</param-name>
>
> <param-value>
>
> [main]
>
> realmA = com.misPartidos.web.MyRealm
>
> </param-value>
>
> </init-param>
>
> </filter>
>
> <filter-mapping>
>
> <filter-name>ShiroFilter</filter-name>
>
> <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
> As I dont know spring I couldnt understand the example given enogh .
>
> Thank in advance
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>