Thanks for you explanation Achim.

As you know I use a WebContainer in Pax-Web today. It suits me very well
since I also use iPojo and do a lot of dynamic initialization that way. I
have a feeling that it would be much harder to do this if I simply deployed
a WAR/WAB. Don't I have to go back to the dreaded XML deployment
descriptors (static) and  instead of being able to do my initialization
dynamically with API calls to the WebContainer?

/Bengt

2016-11-21 9:59 GMT+01:00 Achim Nierbeck <[email protected]>:

> Hi Bengt,
>
> WABs are basically nothing else then std. WARs with an OSGi Manifest
> declaring the Web-ContextPath.
>
> The problem you currently run into, is a very simple one. Well easy to
> explain, but hard to work around.
> So let's take a look at the way a web container works and how web
> applications are usually deployed (std. WARs)
> When you deploy a war you usually end up with a isolated Web Context, so
> everything inside this context is bound to the root context path,
> for example "my-war" context will take care of everything with this
> context, filters, servlets etc.
> Now if you deploy an application on "/" and on "my-war" the separation of
> those contexts already makes sure you have a separation of concern.
> For example filters bound to context "/" will only match for everything in
> "/" which doesn't match "/my-war"
>
> Now let us take a look at how the HttpService works and where those things
> come into play.
> The HttpService doesn't know of those boundaries, so everything deployed
> with the HttpService (this also applies to the webcontainer in Pax-Web as
> it's
> just an enhanced HttpService) is bound to "/" as this is the context of
> it.
> So everything inside this context "/" will be managed by everything we got
> there. Therefore a filter matching "/*" will always match for every other
> root folder. As those are just aliases on top of context "/". That's the
> main difference between HttpServices and regular wars.
>
> regards, Achim
>
>
>
> 2016-11-21 9:37 GMT+01:00 Bengt Rodehav <[email protected]>:
>
>> OK - thanks.
>>
>> I had missed your replies - just saw them.
>>
>> Where can I read about how to use WAB's?
>>
>> The work-around I'm currently using is simply to not install Felix Web
>> console at all but I'd rather fix this in a better way. I don't want to
>> give up Shiro - don't really think that Shiro is the problem here.
>>
>> /Bengt
>>
>> 2016-11-12 14:04 GMT+01:00 Achim Nierbeck <[email protected]>:
>>
>>> Hi,
>>>
>>> afaik the webconsole registers a filter on "/", therefore it will match
>>> any other path registered on "/".
>>> At this point it might be better to use WAB's as those have another
>>> HttpContext.
>>>
>>> regards, Achim
>>>
>>>
>>> 2016-11-11 19:25 GMT+01:00 Pratt, Jason <[email protected]>:
>>>
>>>> I ran into the same issue and eventually gave up using Shiro
>>>>
>>>>
>>>>
>>>> *From:* [email protected] [mailto:[email protected]] *On
>>>> Behalf Of *Bengt Rodehav
>>>> *Sent:* Sunday, November 06, 2016 11:57 PM
>>>> *To:* [email protected]
>>>> *Subject:* Re: Apache Shiro in Karaf
>>>>
>>>>
>>>>
>>>> It seems like the webconsole is what causes me problems. If I install
>>>> the "webconsole" feature, then I'm prompted for basic authentiction when I
>>>> use the anonymous filter in Shiro. If I do not install the "webconsole"
>>>> feature, then this doesn't happen. It seems like the webconsole installs
>>>> some filter that will kick in when I use anonymous filter.
>>>>
>>>>
>>>>
>>>> Anyone has an idea about this?
>>>>
>>>>
>>>>
>>>> I guess as a workaround I'll have to skip the webconsole. Normally I
>>>> would like it installed though since it is very useful.
>>>>
>>>>
>>>>
>>>> /Bengt
>>>>
>>>>
>>>>
>>>> 2016-11-07 8:40 GMT+01:00 Bengt Rodehav <[email protected]>:
>>>>
>>>> Thanks for your reply Steinar,
>>>>
>>>>
>>>>
>>>> I think the difference is that you don't use the anonymous filter
>>>> (keyword "anon" in shiro.ini). I need to use that on a couple of pages that
>>>> need to be accessible by anyone without having to login.
>>>>
>>>>
>>>>
>>>> What happens if you try using "anon"? Will Karaf require basic
>>>> authentication?
>>>>
>>>>
>>>>
>>>> Note also that I have the Karaf web console installed. I think it might
>>>> interfere with this.
>>>>
>>>>
>>>>
>>>> /Bengt
>>>>
>>>>
>>>>
>>>> 2016-11-04 17:27 GMT+01:00 Steinar Bang <[email protected]>:
>>>>
>>>> >>>>> Bengt Rodehav <[email protected]>:
>>>>
>>>> > It seems that if I comment away the following line in
>>>> etc/system.properties
>>>> > then the basic authentication goes away:
>>>>
>>>> > *karaf.local.roles = admin,manager,viewer,systembundles*
>>>>
>>>> > Not sure how this works. Would appreciate if someone could explain.
>>>>
>>>> Except for the fact that one of my karaf installations is failing
>>>> mysteriously I have successfully used shiro basic authentication in
>>>> karaf.
>>>>
>>>> The changes were:
>>>>  1. Added the ShiroFilter to the web.xml of my webapp
>>>>      https://github.com/steinarb/ukelonn/blob/using-primefaces/u
>>>> kelonn.bundle/src/main/webapp/WEB-INF/web.xml
>>>>  2. Added a shiro.ini file to the webapp
>>>>      https://github.com/steinarb/ukelonn/blob/using-primefaces/u
>>>> kelonn.bundle/src/main/webapp/WEB-INF/shiro.ini
>>>>  3. Added a custom realm (maybe I can replace this by the JDBC realm...?
>>>>     But I was trying out stuff and learning as I created it)
>>>>       https://github.com/steinarb/ukelonn/blob/using-primefaces/uk
>>>> elonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnRealm.java
>>>>  4. Added a redirection in the main JSF page redirecting the admins to a
>>>>     different page (that's the preRenderView <f:event> tag)
>>>>       https://github.com/steinarb/ukelonn/blob/using-primefaces/uk
>>>> elonn.bundle/src/main/webapp/ukelonn.xhtml
>>>>  5. Added a redirect method to the bean serving the main JSF page
>>>>      https://github.com/steinarb/ukelonn/blob/using-primefaces/u
>>>> kelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/Ukelon
>>>> nController.java
>>>>  6. Pulled in shiro-core and shiro-web as runtime dependencies
>>>>      https://github.com/steinarb/ukelonn/blob/using-primefaces/u
>>>> kelonn.karaf/ukelonn/pom.xml
>>>>
>>>> And that was it, basically.
>>>>
>>>> I basically just followed the directions I found here, and adapted them
>>>> to a pax-web setting:
>>>>  http://balusc.omnifaces.org/2013/01/apache-shiro-is-it-read
>>>> y-for-java-ee-6.html
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Apache Member
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>>> & Project Lead
>>> blog <http://notizblog.nierbeck.de/>
>>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>>
>>> Software Architect / Project Manager / Scrum Master
>>>
>>>
>>
>
>
> --
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master
>
>

Reply via email to