>>>>> João Assunção <joao.assun...@exploitsys.com>:

> Hi Steinar
> A few years ago I implemented a servlet filter to handle CORS. The filter
> was a DS component and it accepted a configuration via activate. Everytime
> the config was changed, it would restart and update the filter.

You wouldn't happen to be able to share the shiro filter reload code, by
any chance...? :-)

(I understand if the answer is "no", but it doesn't hurt to ask...:-) )

> You can also have the DS component implement the filter interface and an
> auxiliary service interface with a method to force a reload of the config
> without restarting.
> I guess it depends on how you supply the configuration to the filter.

The filter is here:
 
https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L35

The version of the filter does runtime reconfiguration hasn't been
pushed yet, but it will look like this:
 
https://gist.github.com/steinarb/1c16c1ce4f6148b47581019de1d23e40#file-oldalbumshirofilter-java-L66

Here an OldalbumService is injected and is used as a constructor
argument to an OldAlbumWebEnvironment, which will look like this (not
pushed yet):
 
https://gist.github.com/steinarb/a7b4bff8786d9e0e37a8925e19090068#file-oldalbumwebenvironment-java-L23

The OldAlbumWebEnvironment in the constructor creates a custom Ini
object with an "urls" section containing paths retrieved from the
OldAlbumService.

So no notification implemented yet, just reading urls paths at startup,
in addition to what's read from the shiro.ini
 
https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/resources/shiro.ini

Reply via email to