Hi AndrejKr

It's easy, you don't need to register the filter anywhere, just use it
in contributeSecurityConfiguration.
for example:

public static void
contributeSecurityConfiguration(Configuration<SecurityFilterChain>
configuration,
                        SecurityFilterChainFactory factory, WebSecurityManager 
securityManager) {
        configuration.add(factory.createChain("/blockedbyip").add(new
ArtisolHostFilter("192.168.112.2,10.0.0.170"));
}

BTW, you need to extend from our own
org.tynamo.security.shiro.authz.AuthorizationFilter

Cheers.
Alejandro.



On Tue, Feb 21, 2012 at 17:00, AndrejKr <akrus...@gmail.com> wrote:
> hi,
> i am new to Tapestry-Security and to this forum so am sorry if this is not
> in the correct thread.
> in version 0.3.1 I could do the thing described few lines down (securing to
> specific IP).
> I was wondering how to do this in AppModule.java in version 0.4.1 if
> shiro.ini and com.xxxx.util.xxxxHostFilter.class  would be like this:
>
> shiro.ini:
> [main]
> ip = com.xxxx.util.xxxxHostFilter
> ip.authorizedIps = 127.0.0.1, 192.168.1.12
>
> [users]
>
> [roles]
>
> [urls]
> /rest/index/** = anon
> /rest/** = ip
>
>
> the com.xxxx.util.xxxxHostFilter.cass:
> ...
> import org.apache.shiro.web.filter.authz.AuthorizationFilter;
>
> public class ArtisolHostFilter extends AuthorizationFilter {
>
>    private Set<String> authorizedIps = new HashSet<String>();
>
>    public void setAuthorizedIps(String ips) {
>        for (String ip : ips.split(",")) {
>            authorizedIps.add(ip.trim());
>        }
>    }
>
>    @Override
>    protected boolean isAccessAllowed(ServletRequest request,
> ServletResponse response, Object mappedValue) throws Exception {
>        String remoteAddr = request.getRemoteAddr();
>        return authorizedIps.contains(remoteAddr);
>    }
> }
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/ANNOUNCEMENT-Tapestry-security-0-4-1-released-tp5432299p5502612.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to