shiro icon indicating copy to clipboard operation
shiro copied to clipboard

[SHIRO-671] Add support for JSR-250 annotations DenyAll, PermitAll, RolesAllowed

Open bdemers opened this issue 4 years ago • 5 comments

Fixes: SHIRO-671

NOTE: this is the first pass, and uncovered a few issues with the differences between the JSR-250 and Shiro Annotations.

  • RolesAllowed only supports a logical OR, RequiresRoles defaults to a logical AND
  • PermitAll allows any subject (guest or not)
  • Per spec there is interaction between the JSR-250 annotations that the Shiro Annotations do NOT have.
    • Each Shiro annotation is processed without knowledge of other annotations, the JSR-250 versions are processed together, for example
    @PermitAll
    class ExamplePermitAtClass {

        @DenyAll
        void expectDenied() {}

        void expectAllowed() {}

        @RolesAllowed({"blah2", "foo"})
        void withRoles() {}
    }

To implement this I needed to search out the annotations in Jsr250MethodInterceptor without the use of the AnnotationResolver component, the issue here is we have a separate implementation for Spring.

We could extend the AnnotationResolver interface and add methods that return annotations for a Class, or a method. (the current method does both).

TODO:

  • [ ] Make sure Javadoc has been added
  • [ ] Add JAX-RS support
  • [ ] Add Spring Support
  • [ ] Add Guice support

bdemers avatar Dec 05 '19 22:12 bdemers

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/Shiro-pr/189/

Build result: FAILURE

[...truncated 373.87 KB...][JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/core/pom.xml to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/core/target/shiro-core-1.5.0-SNAPSHOT.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/core/target/shiro-core-1.5.0-SNAPSHOT-tests.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/core/target/shiro-core-1.5.0-SNAPSHOT-javadoc.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/core/target/shiro-core-1.5.0-SNAPSHOT-sources.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/samples/aspectj/pom.xml to org.apache.shiro.samples/samples-aspectj/1.5.0-SNAPSHOT/samples-aspectj-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/samples/spring-boot-web/pom.xml to org.apache.shiro.samples/samples-spring-boot-web/1.5.0-SNAPSHOT/samples-spring-boot-web-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/samples/spring-client/pom.xml to org.apache.shiro.samples/samples-spring-client/1.5.0-SNAPSHOT/samples-spring-client-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/tools/hasher/pom.xml to org.apache.shiro.tools/shiro-tools-hasher/1.5.0-SNAPSHOT/shiro-tools-hasher-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/support/spring-boot/spring-boot-starter/pom.xml to org.apache.shiro/shiro-spring-boot-starter/1.5.0-SNAPSHOT/shiro-spring-boot-starter-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/support/jaxrs/pom.xml to org.apache.shiro/shiro-jaxrs/1.5.0-SNAPSHOT/shiro-jaxrs-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/samples/guice/pom.xml to org.apache.shiro.samples/samples-guice/1.5.0-SNAPSHOT/samples-guice-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/crypto/cipher/pom.xml to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT-javadoc.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT-sources.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/samples/web/pom.xml to org.apache.shiro.samples/samples-web/1.5.0-SNAPSHOT/samples-web-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/support/servlet-plugin/pom.xml to org.apache.shiro/shiro-servlet-plugin/1.5.0-SNAPSHOT/shiro-servlet-plugin-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/support/spring/pom.xml to org.apache.shiro/shiro-spring/1.5.0-SNAPSHOT/shiro-spring-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr/support/guice/pom.xml to org.apache.shiro/shiro-guice/1.5.0-SNAPSHOT/shiro-guice-1.5.0-SNAPSHOT.pomchannel stoppedSetting status of c6d547dc6af218f088a06001da8dc0ff8cec7abd to FAILURE with url https://builds.apache.org/job/Shiro-pr/189/ and message: 'FAILURE 'Using context: Jenkins: mvn clean install

asf-ci avatar Dec 05 '19 22:12 asf-ci

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/Shiro-pr-jdk11/20/

Build result: FAILURE

[...truncated 377.83 KB...][JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/core/target/shiro-core-1.5.0-SNAPSHOT.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/core/target/shiro-core-1.5.0-SNAPSHOT-tests.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-tests.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/core/target/shiro-core-1.5.0-SNAPSHOT-javadoc.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/core/target/shiro-core-1.5.0-SNAPSHOT-sources.jar to org.apache.shiro/shiro-core/1.5.0-SNAPSHOT/shiro-core-1.5.0-SNAPSHOT-sources.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/samples/aspectj/pom.xml to org.apache.shiro.samples/samples-aspectj/1.5.0-SNAPSHOT/samples-aspectj-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/samples/spring-boot-web/pom.xml to org.apache.shiro.samples/samples-spring-boot-web/1.5.0-SNAPSHOT/samples-spring-boot-web-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/samples/spring-client/pom.xml to org.apache.shiro.samples/samples-spring-client/1.5.0-SNAPSHOT/samples-spring-client-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/tools/hasher/pom.xml to org.apache.shiro.tools/shiro-tools-hasher/1.5.0-SNAPSHOT/shiro-tools-hasher-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/support/spring-boot/spring-boot-starter/pom.xml to org.apache.shiro/shiro-spring-boot-starter/1.5.0-SNAPSHOT/shiro-spring-boot-starter-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/support/jaxrs/pom.xml to org.apache.shiro/shiro-jaxrs/1.5.0-SNAPSHOT/shiro-jaxrs-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/samples/guice/pom.xml to org.apache.shiro.samples/samples-guice/1.5.0-SNAPSHOT/samples-guice-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/crypto/cipher/pom.xml to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT-javadoc.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT-javadoc.jar[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/crypto/cipher/target/shiro-crypto-cipher-1.5.0-SNAPSHOT-sources.jar to org.apache.shiro/shiro-crypto-cipher/1.5.0-SNAPSHOT/shiro-crypto-cipher-1.5.0-SNAPSHOT-sources.jar[Fast Archiver] Compressed 522.29 KB of artifacts by 36.8% relative to #19[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/samples/web/pom.xml to org.apache.shiro.samples/samples-web/1.5.0-SNAPSHOT/samples-web-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/support/servlet-plugin/pom.xml to org.apache.shiro/shiro-servlet-plugin/1.5.0-SNAPSHOT/shiro-servlet-plugin-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/support/spring/pom.xml to org.apache.shiro/shiro-spring/1.5.0-SNAPSHOT/shiro-spring-1.5.0-SNAPSHOT.pom[JENKINS] Archiving /home/jenkins/jenkins-slave/workspace/Shiro-pr-jdk11/support/guice/pom.xml to org.apache.shiro/shiro-guice/1.5.0-SNAPSHOT/shiro-guice-1.5.0-SNAPSHOT.pomchannel stoppedSetting status of c6d547dc6af218f088a06001da8dc0ff8cec7abd to FAILURE with url https://builds.apache.org/job/Shiro-pr-jdk11/20/ and message: 'FAILURE 'Using context: Jenkins: mvn clean install

asf-ci avatar Dec 05 '19 22:12 asf-ci

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/Shiro-pr-jdk11/21/

Failed Tests: 1

Shiro-pr-jdk11/org.apache.shiro:shiro-web: 1

asf-ci avatar Dec 05 '19 23:12 asf-ci

Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/Shiro-pr/190/

asf-ci avatar Dec 06 '19 00:12 asf-ci

retest this please

fpapon avatar Aug 10 '20 12:08 fpapon

Superseded by #714

lprimak avatar Feb 04 '23 06:02 lprimak