Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Apache Karaf is a small OSGi based runtime which provides a lightweight container onto which various components and applications can be deployed.

      The following patch provides a features.xml which can be used in to install Apache Shiro easily in Apache Karaf. To test the patch download apache karaf 2.2.0-SNAPSHOT (because of the used obr resolver not backward-compatible to 2.1.x; but we're going to release karaf-2.2.0 very soon anyway...) here [1] or here [2], unizp/untar; now start Karaf:

      pieber@coprime [04:18:58] [~/apache-karaf-2.1.99-SNAPSHOT] 
      -> % ./bin/karaf 
              __ __                  ____      
             / //_/____ __________ _/ __/      
            / ,<  / __ `/ ___/ __ `/ /_        
           / /| |/ /_/ / /  / /_/ / __/        
          /_/ |_|\__,_/_/   \__,_/_/         
      
        Apache Karaf (2.1.99-SNAPSHOT)
      
      Hit '<tab>' for a list of available commands
      and '[cmd] --help' for help on a specific command.
      Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.
      
      

      Afterwards add the new shiro features file:

      karaf@root> features:addurl mvn:org.apache.shiro/shiro-features/1.2.0-SNAPSHOT/xml/features
      

      Now we can install the features...

      karaf@root> features:install shiro-web shiro-ehcache shiro-quartz shiro-spring shiro-aspectj
      

      ... and check if everything was installed correctly

      karaf@root> list
      START LEVEL 100 , List Threshold: 50
         ID   State         Blueprint      Level  Name
      [  42] [Active     ] [            ] [   60] Apache Shiro :: Core (1.2.0.SNAPSHOT)
      [  43] [Active     ] [            ] [   60] geronimo-servlet_2.5_spec (1.1.2)
      [  44] [Active     ] [            ] [   60] Jetty :: Utilities (7.2.2.v20101205)
      [  45] [Active     ] [            ] [   60] Jetty :: IO Utility (7.2.2.v20101205)
      [  46] [Active     ] [            ] [   60] Jetty :: Http Utility (7.2.2.v20101205)
      [  47] [Active     ] [            ] [   60] Jetty :: Continuation (7.2.2.v20101205)
      [  48] [Active     ] [            ] [   60] Jetty :: Server Core (7.2.2.v20101205)
      [  49] [Active     ] [            ] [   60] Jetty :: Security (7.2.2.v20101205)
      [  50] [Active     ] [            ] [   60] Jetty :: Servlet Handling (7.2.2.v20101205)
      [  51] [Active     ] [            ] [   60] Jetty :: XML utilities (7.2.2.v20101205)
      [  52] [Active     ] [            ] [   60] OPS4J Pax Web - API (1.0.1)
      [  53] [Active     ] [            ] [   60] OPS4J Pax Web - Service SPI (1.0.1)
      [  54] [Active     ] [            ] [   60] OPS4J Pax Web - Runtime (1.0.1)
      [  55] [Active     ] [            ] [   60] OPS4J Pax Web - Jetty (1.0.1)
      [  57] [Active     ] [            ] [   60] OPS4J Pax Web - Jsp Support (1.0.1)
      [  58] [Active     ] [            ] [   60] OPS4J Pax Web - Extender - WAR (1.0.1)
      [  59] [Active     ] [            ] [   60] OPS4J Pax Web - Extender - Whiteboard (1.0.1)
      [  60] [Active     ] [            ] [   60] OPS4J Pax Web - FileInstall Deployer (1.0.1)
      [  61] [Active     ] [            ] [   60] OPS4J Pax Url - war:, war-i: (1.2.5)
      [  62] [Active     ] [            ] [   60] Apache Shiro :: Web (1.2.0.SNAPSHOT)
      [  63] [Active     ] [            ] [   60] Apache ServiceMix :: Bundles :: ehcache (2.3.0.1)
      [  64] [Active     ] [            ] [   60] Apache Shiro :: Support :: EHCache (1.2.0.SNAPSHOT)
      [  65] [Active     ] [            ] [   60] Commons Collections (3.2.1)
      [  66] [Active     ] [            ] [   60] Apache ServiceMix Bundles: quartz-1.6.1 (1.6.1.1)
      [  67] [Active     ] [            ] [   60] Apache Shiro :: Support :: Quartz (1.2.0.SNAPSHOT)
      [  68] [Active     ] [            ] [   60] Apache ServiceMix :: Bundles :: aopalliance (1.0.0.4)
      [  69] [Active     ] [            ] [   60] Spring Core (3.0.5.RELEASE)
      [  70] [Active     ] [            ] [   60] Spring ASM (3.0.5.RELEASE)
      [  71] [Active     ] [            ] [   60] Spring Expression Language (3.0.5.RELEASE)
      [  72] [Active     ] [            ] [   60] Spring Beans (3.0.5.RELEASE)
      [  73] [Active     ] [            ] [   60] Spring AOP (3.0.5.RELEASE)
      [  74] [Active     ] [            ] [   60] Spring Context (3.0.5.RELEASE)
      [  75] [Active     ] [            ] [   60] Spring Context Support (3.0.5.RELEASE)
      [  76] [Active     ] [            ] [   60] Apache Shiro :: Support :: Spring (1.2.0.SNAPSHOT)
      [  77] [Active     ] [            ] [   60] Apache ServiceMix :: Bundles :: aspectj (1.6.8.1)
      [  78] [Active     ] [            ] [   60] Apache Shiro :: Support :: AspectJ (1.2.0.SNAPSHOT)
      

      [1] http://repository.apache.org/snapshots/org/apache/karaf/assemblies/apache-karaf/apache-karaf/2.1.99-SNAPSHOT/apache-karaf-2.1.99-SNAPSHOT.tar.gz
      [2] http://repository.apache.org/snapshots/org/apache/karaf/assemblies/apache-karaf/apache-karaf/2.1.99-SNAPSHOT/apache-karaf-2.1.99-SNAPSHOT.zip

        Activity

        Hide
        Cristiano Gavião added a comment -

        Well strange, I could swear that I had clicked on watch button... but I've not received any email from any comments.

        I've delete my maven repository and tried again..

        Everything is ok as stated by Andreas !! thanks.

        cheers

        Cristiano

        Show
        Cristiano Gavião added a comment - Well strange, I could swear that I had clicked on watch button... but I've not received any email from any comments. I've delete my maven repository and tried again.. Everything is ok as stated by Andreas !! thanks. cheers Cristiano
        Hide
        Andreas Pieber added a comment -

        Sorry for my delay. I would have answered early but I completely missed the notification mail about Christiano's comment

        @Christiano: I've just tested it again and it seams to work for me:

        karaf@root> list
        START LEVEL 100 , List Threshold: 50
           ID   State         Blueprint      Level  Name
        [  42] [Active     ] [            ] [   60] Apache Shiro :: Core (1.2.0.SNAPSHOT)
        [  43] [Active     ] [            ] [   60] Apache ServiceMix :: Bundles :: ehcache (2.3.0.1)
        [  44] [Active     ] [            ] [   60] Apache Shiro :: Support :: EHCache (1.2.0.SNAPSHOT)
        

        Looking into the shiro ehcache pom i found the following:

        <Import-Package>
          org.apache.shiro*;version="${shiro.osgi.importRange}",
          net.sf.ehcache*;version="[2.3, 3)",
          *
        </Import-Package>
        

        --> org.apache.shiro.ehcache [70]: Unable to resolve 70.0: missing requirement [70.0] package; (&(package=net.sf.ehcache)(version>=1.4.0)(!(version>=2.0.0)))

        says that you're using an old snapshot-version of shiro ehcache. This could happen with the snapshots since karaf simply takes what it could find in your local mvn repo. Either simply remove your local .m2/repository/org/apache/shiro folder and let maven grep the latest version or build shiro yourself locally should fix the problem.

        Sorry again for the delay and kind regards,
        Andreas

        Show
        Andreas Pieber added a comment - Sorry for my delay. I would have answered early but I completely missed the notification mail about Christiano's comment @Christiano: I've just tested it again and it seams to work for me: karaf@root> list START LEVEL 100 , List Threshold: 50 ID State Blueprint Level Name [ 42] [Active ] [ ] [ 60] Apache Shiro :: Core (1.2.0.SNAPSHOT) [ 43] [Active ] [ ] [ 60] Apache ServiceMix :: Bundles :: ehcache (2.3.0.1) [ 44] [Active ] [ ] [ 60] Apache Shiro :: Support :: EHCache (1.2.0.SNAPSHOT) Looking into the shiro ehcache pom i found the following: <Import-Package> org.apache.shiro*;version= "${shiro.osgi.importRange}" , net.sf.ehcache*;version= "[2.3, 3)" , * </Import-Package> --> org.apache.shiro.ehcache [70] : Unable to resolve 70.0: missing requirement [70.0] package; (&(package=net.sf.ehcache)(version>=1.4.0)(!(version>=2.0.0))) says that you're using an old snapshot-version of shiro ehcache. This could happen with the snapshots since karaf simply takes what it could find in your local mvn repo. Either simply remove your local .m2/repository/org/apache/shiro folder and let maven grep the latest version or build shiro yourself locally should fix the problem. Sorry again for the delay and kind regards, Andreas
        Hide
        Les Hazlewood added a comment -

        Andreas, do you know what might be Cristiano's issue? My understanding is that you must install ehcache before the shiro-ehcache jar, but I'm not sure if the features file should have enough information for Karaf to pull it in automatically...

        Show
        Les Hazlewood added a comment - Andreas, do you know what might be Cristiano's issue? My understanding is that you must install ehcache before the shiro-ehcache jar, but I'm not sure if the features file should have enough information for Karaf to pull it in automatically...
        Hide
        Cristiano Gavião added a comment -

        When I try to install shiro-ehcache I got this error:

        features:install shiro-ehcache
        Error executing command: Could not start bundle mvn:org.apache.shiro/shiro-ehcache/1.2.0-SNAPSHOT in feature(s) shiro-ehcache-1.2.0-SNAPSHOT: Unresolved constraint in bundle org.apache.shiro.ehcache [70]: Unable to resolve 70.0: missing requirement [70.0] package; (&(package=net.sf.ehcache)(version>=1.4.0)(!(version>=2.0.0)))

        should I install net.sf.ehcache before or install shiro-ehcache must deal with that?

        Show
        Cristiano Gavião added a comment - When I try to install shiro-ehcache I got this error: features:install shiro-ehcache Error executing command: Could not start bundle mvn:org.apache.shiro/shiro-ehcache/1.2.0-SNAPSHOT in feature(s) shiro-ehcache-1.2.0-SNAPSHOT: Unresolved constraint in bundle org.apache.shiro.ehcache [70] : Unable to resolve 70.0: missing requirement [70.0] package; (&(package=net.sf.ehcache)(version>=1.4.0)(!(version>=2.0.0))) should I install net.sf.ehcache before or install shiro-ehcache must deal with that?
        Hide
        Andreas Pieber added a comment -

        Thank you very much Les. I've just tested the shiro trunk with karaf-2.2 release and everything works fine

        Show
        Andreas Pieber added a comment - Thank you very much Les. I've just tested the shiro trunk with karaf-2.2 release and everything works fine
        Hide
        Les Hazlewood added a comment -

        Andreas, I've committed the last change that should make this work. I'm resolving it for now, but if something still needs to be fixed, please re-open the issue.

        Cheers,

        Les

        Show
        Les Hazlewood added a comment - Andreas, I've committed the last change that should make this work. I'm resolving it for now, but if something still needs to be fixed, please re-open the issue. Cheers, Les
        Hide
        Andreas Pieber added a comment -

        Hey Les,

        @Hardcoding the latest commons.collection version: this is fine for me

        @Quartz and aspectj: I'm terrible sorry, it seams that I really forgot to add them to the patch:

         
                 <!-- Compile 3rd party dependencies: -->
        -        <aspectj.version>1.6.9</aspectj.version>
        +        <aspectj.version>1.6.8</aspectj.version>
        +        <aspectj.bundle.version>1.6.8_1</aspectj.bundle.version>
                 <crowd.version>1.5.2</crowd.version>
        -        <ehcache.version>2.2.0</ehcache.version>
        +        <ehcache.version>2.3.0</ehcache.version>
        +        <ehcache.bundle.version>2.3.0_1</ehcache.bundle.version>
                 <groovy.version>1.7.8</groovy.version>
                 <hsqldb.version>1.8.0.7</hsqldb.version>
                 <jdk.version>1.5</jdk.version>
                 <jetty.version>6.1.21</jetty.version>
                 <openid4j.version>0.9.5</openid4j.version>
                 <quartz.version>1.6.1</quartz.version>
        +        <commons.collections.version>3.2.1</commons.collections.version>
        +        <quartz.bundle.version>1.6.1_1</quartz.bundle.version>
                 <slf4j.version>1.6.1</slf4j.version>
                 <spring.version>3.0.5.RELEASE</spring.version>
        

        The two different versions where required because the "default" version is not osginized. Using your quartz and aspectj versions alone does not work that way with karaf It would be great if the bundle versions could be used of aspectj, ehcache and quartz (for the karaf impl).

        Thank you very much again for your effort and kind regards,
        Andreas

        Show
        Andreas Pieber added a comment - Hey Les, @Hardcoding the latest commons.collection version: this is fine for me @Quartz and aspectj: I'm terrible sorry, it seams that I really forgot to add them to the patch: <!-- Compile 3rd party dependencies: --> - <aspectj.version>1.6.9</aspectj.version> + <aspectj.version>1.6.8</aspectj.version> + <aspectj.bundle.version>1.6.8_1</aspectj.bundle.version> <crowd.version>1.5.2</crowd.version> - <ehcache.version>2.2.0</ehcache.version> + <ehcache.version>2.3.0</ehcache.version> + <ehcache.bundle.version>2.3.0_1</ehcache.bundle.version> <groovy.version>1.7.8</groovy.version> <hsqldb.version>1.8.0.7</hsqldb.version> <jdk.version>1.5</jdk.version> <jetty.version>6.1.21</jetty.version> <openid4j.version>0.9.5</openid4j.version> <quartz.version>1.6.1</quartz.version> + <commons.collections.version>3.2.1</commons.collections.version> + <quartz.bundle.version>1.6.1_1</quartz.bundle.version> <slf4j.version>1.6.1</slf4j.version> <spring.version>3.0.5.RELEASE</spring.version> The two different versions where required because the "default" version is not osginized. Using your quartz and aspectj versions alone does not work that way with karaf It would be great if the bundle versions could be used of aspectj, ehcache and quartz (for the karaf impl). Thank you very much again for your effort and kind regards, Andreas
        Hide
        Les Hazlewood added a comment -

        Andreas or Charles,

        I applied the patch, but I had to modify some things. I don't know if the modifications are totally accurate, so can you please review them?

        In the features.xml file, there were a few property references like:

        $

        {quartz.bundle.version}

        $

        {aspectj.bundle.version}

        However, we don't have these properties defined in our poms. I changed them to match the ones we do already have, i.e. $

        {quartz.version}

        and $

        {aspectj.version}

        . Is this ok?

        Also, there was a reference to a $

        {commons.collections.version}

        property. Shiro doesn't use commons-collections anywhere , so I just hard coded the latest stable version of '3.2.1'.

        Can you please confirm that these edits are ok? Or is there something else that should be done?

        Thanks,

        Les

        Show
        Les Hazlewood added a comment - Andreas or Charles, I applied the patch, but I had to modify some things. I don't know if the modifications are totally accurate, so can you please review them? In the features.xml file, there were a few property references like: $ {quartz.bundle.version} $ {aspectj.bundle.version} However, we don't have these properties defined in our poms. I changed them to match the ones we do already have, i.e. $ {quartz.version} and $ {aspectj.version} . Is this ok? Also, there was a reference to a $ {commons.collections.version} property. Shiro doesn't use commons-collections anywhere , so I just hard coded the latest stable version of '3.2.1'. Can you please confirm that these edits are ok? Or is there something else that should be done? Thanks, Les
        Hide
        Les Hazlewood added a comment -

        Hi guys,

        I think I can do this sometime today - it will probably go in trunk and be available for 1.2.

        Cheers,

        Les

        Show
        Les Hazlewood added a comment - Hi guys, I think I can do this sometime today - it will probably go in trunk and be available for 1.2. Cheers, Les
        Hide
        Charles Moulliard added a comment -

        Hi Andreas,

        I have added a comment on shiro ticket.

        Regards,

        Charles

        Show
        Charles Moulliard added a comment - Hi Andreas, I have added a comment on shiro ticket. Regards, Charles
        Hide
        Charles Moulliard added a comment -

        Hi Shiro guys,

        Apache Camel and Karaf projects use more and more Apache Shiro projects to deliver security (http://camel.apache.org/shiro-security.html) within projects. This will be very nice if someone can apply the patch to allow us to extend realms of Apache Karaf to use Apache Shiro and provide alternative to JAAS or Spring Security.

        Regards,

        Charles

        Show
        Charles Moulliard added a comment - Hi Shiro guys, Apache Camel and Karaf projects use more and more Apache Shiro projects to deliver security ( http://camel.apache.org/shiro-security.html ) within projects. This will be very nice if someone can apply the patch to allow us to extend realms of Apache Karaf to use Apache Shiro and provide alternative to JAAS or Spring Security. Regards, Charles
        Hide
        Andreas Pieber added a comment -

        hey guys,

        Since Karaf-2.2 is now finally out; any interest in applying this patch?

        Kind regards,
        Andreas

        Show
        Andreas Pieber added a comment - hey guys, Since Karaf-2.2 is now finally out; any interest in applying this patch? Kind regards, Andreas

          People

          • Assignee:
            Les Hazlewood
            Reporter:
            Andreas Pieber
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development