>>>>> Steinar Bang <s...@dod.no>:
>  2. Then I create a component creating ShiroFilter plugging into the
>     servlet context created by the ServletContextHelper
>      
> https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L35

This filter already knows the WebEnvironment
 
https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L58

It knows nothing about the database status, however.

But since this is OSGi I can get an OldAlbumService injected:
 
https://github.com/steinarb/oldalbum/blob/master/oldalbum.services/src/main/java/no/priv/bang/oldalbum/services/OldAlbumService.java#L30

And then I can call OldAlbumService.fetchAllRoutes() to get all paths
that have login settings and add them to the urls section (so to speak),
in the correct order.

The would require a restart to pick up any filter changes, but it is a
start.

Further possible approaches:
 1. Create some form of callback that can send allroutes up to the
    filter when it changes
 2. Create a custom filter that calls to the backend to find paths to
    filter

Alterative 2 is cleanest but I worry about the performance about doing a
database operation for each call.

Reply via email to