Hi, there is a sample app for Pax-Web, which is also used in the test-suite: https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/war-authentication And actually you just need to reference the jaas of the surrounding Karaf instance in your web.xml file.
regards, Achim Am Fr., 8. Mai 2020 um 18:41 Uhr schrieb Alex Soto <[email protected]>: > Hello, > > Is there a good tutorial or documentation on how to protect a WAB (Web > Application Bundle) with JAAS authentication? > My Karaf version is 4.2.8. Documentation here > https://karaf.apache.org/manual/latest/webcontainer is scarce, only > referring to Jetty global config, (even that failed for me). I have > multiple WABs and WARs in the same Karaf container, and I don’t want to > apply the same JAAS authentication to all of them. From the comment: > > <!-- =========================================================== --> > <!-- Configure Authentication Realms --> > <!-- Realms may be configured for the entire server here, or --> > <!-- they can be configured for a specific web app in a context --> > <!-- configuration (see $(jetty.home)/contexts/test.xml for an --> > <!-- example). --> > <!-- =========================================================== —> > > It looks like is a way ($(jetty.home)/contexts/test.xml ). But this is > unclear on how to apply, and it is Jetty specific. > My preference is for a Jetty agnostic way, for portability reasons. (Maybe > Karaf will change to Undertow in the future) > > > Best regards, > Alex soto > > > > > -- 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>
