You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Thomas Driessen <th...@ds-lab.org> on 2015/05/13 14:14:34 UTC

Shiro Integration in OSGi based WebApp

Hi,

I'm currently working on a web app, which relies on OSGi on the server
side. I want to integrate Apache Shiro for securing my Rest Endpoints,
which I created via the Amdatu Web Project. [1]
The problem I'm currently struggling with is: How do I integrate Apache
Shiro in an OSGi Environment? The shiro-core and shiro-web jars are already
bundles, but how do I initialize Shiro the best way?

The tutorial [2] advices me to add a EnvironmentLoaderListener and the
ShiroFilter to my web.xml, but with my setup there is no more web.xml (or
am I wrong at this point?) So I tried a different way described here [3]:
Via Whiteboard registration the ShiroFilter and EnvironmentLoaderListener
should be added by registering them under the interfaces Filter and
ServletContextListener (SCL).

My Question is: Is the whiteboard style registration a valid way to
initialize Shiro? (Unfortunately I couldn't test it yet, as the current
stable version of the whiteboard doesn't support SCL yet, but the current
Snapshot-version does and I'm trying to get those to work :) )

If it is not a valid way to initialize shiro in this OSGi-Web context, then
how would you recommend me to do it?

Any advice is appreciated :)

Best regards,
Thomas


[1] http://www.amdatu.org/components/web.html
[2] http://shiro.apache.org/web.html#Web-Configuration
[3]
http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#using-the-whiteboard

-- 
M.Sc. Thomas Driessen
Software Methodologies for Distributed Systems
Institute of Computer Science
University of Augsburg
Universitätsstr. 6a
86135 Augsburg, Germany

Tel:    +49 821 598-2486
email: thomas.driessen@informatik.uni-augsburg.de