IP restriction in specific actions with AcegiSecurity

Hi,

Need to make one specific controller/action visible just to one IP? That’s easy using another Acegi configuration option in your SecurityConfig. You can use this to restrict the acess for some intranet part of your application, this is really easy and useful! Try adding this in your <app>/grails-app/conf/SecurityConfig.groovy

ipRestrictions = ['/admin/**': '127.0.0.1',
'/myController/myAction': '10.**']

This will make the first all actions in admin controller (or any other thing mapped with this pattern) accessable only from the machine that is running the application, and “myAction” of “myController” accessable from any ip starting with 10.

Remeber… As the documentation says, ALL ACTIONS can be accesses from localhost (the example I said above), no matter what you do in your mappings.

:)

2 Comments so far

  1. Raphael on March 21st, 2009

    Man, snipplr really needs an embed feature.

  2. lucastex on March 23rd, 2009

    @Raphael

    I’m having hard times trying this. Every plugin/feature just crashes all my layout. :(

Leave a Reply

Web Analytics