deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-735 allow multiple stereotypes annotated with @Secured
Date Tue, 30 Sep 2014 18:09:13 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master c574593f0 -> 16411e602


DELTASPIKE-735 allow multiple stereotypes annotated with @Secured


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/16411e60
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/16411e60
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/16411e60

Branch: refs/heads/master
Commit: 16411e602b0dbb839cd0fbfc646a9b8ef0bc04ed
Parents: c574593
Author: gpetracek <gpetracek@apache.org>
Authored: Tue Sep 30 19:53:57 2014 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Tue Sep 30 20:05:28 2014 +0200

----------------------------------------------------------------------
 .../authorization/SecuredAnnotationAuthorizer.java     | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/16411e60/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
index 07a4f1c..bcfc810 100644
--- a/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
+++ b/deltaspike/modules/security/impl/src/main/java/org/apache/deltaspike/security/impl/authorization/SecuredAnnotationAuthorizer.java
@@ -57,7 +57,7 @@ public class SecuredAnnotationAuthorizer
     @SuppressWarnings("UnusedDeclaration")
     public boolean doSecuredCheck(InvocationContext invocationContext) throws Exception
     {
-        Secured secured = null;
+        List<Class<? extends AccessDecisionVoter>> voterClasses = new ArrayList<Class<?
extends AccessDecisionVoter>>();
 
         List<Annotation> annotatedTypeMetadata = extractMetadata(invocationContext);
 
@@ -65,7 +65,7 @@ public class SecuredAnnotationAuthorizer
         {
             if (Secured.class.isAssignableFrom(annotation.annotationType()))
             {
-                secured = (Secured) annotation;
+                voterClasses.addAll(Arrays.asList(((Secured) annotation).value()));
             }
             else if (voterContext instanceof EditableAccessDecisionVoterContext)
             {
@@ -74,12 +74,7 @@ public class SecuredAnnotationAuthorizer
             }
         }
 
-        if (secured != null)
-        {
-            Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();
-
-            invokeVoters(invocationContext, Arrays.asList(voterClasses));
-        }
+        invokeVoters(invocationContext, voterClasses);
 
         //needed by @SecurityBindingType
         //X TODO check the use-cases for it
@@ -107,7 +102,7 @@ public class SecuredAnnotationAuthorizer
     private void invokeVoters(InvocationContext invocationContext,
                               List<Class<? extends AccessDecisionVoter>> accessDecisionVoters)
     {
-        if (accessDecisionVoters == null)
+        if (accessDecisionVoters.isEmpty())
         {
             return;
         }


Mime
View raw message