deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject deltaspike git commit: DELTASPIKE-873 improved handling of @Secured without DefaultErrorView
Date Fri, 01 May 2015 20:42:48 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 077eadb0c -> 64a2eeb71


DELTASPIKE-873 improved handling of @Secured without DefaultErrorView


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

Branch: refs/heads/master
Commit: 64a2eeb719daa8114032415658f40a7d0699239e
Parents: 077eadb
Author: gpetracek <gpetracek@apache.org>
Authored: Fri May 1 22:42:25 2015 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri May 1 22:42:25 2015 +0200

----------------------------------------------------------------------
 .../jsf/impl/security/SecurityAwareViewHandler.java      | 11 +----------
 .../apache/deltaspike/jsf/impl/util/SecurityUtils.java   | 10 ++++------
 2 files changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/64a2eeb7/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java
index e6bc657..7d5115f 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/SecurityAwareViewHandler.java
@@ -18,7 +18,6 @@
  */
 package org.apache.deltaspike.jsf.impl.security;
 
-import org.apache.deltaspike.core.api.config.view.ViewConfig;
 import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;
 import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
@@ -115,8 +114,6 @@ public class SecurityAwareViewHandler extends ViewHandlerWrapper implements
Deac
         }
         catch (ErrorViewAwareAccessDeniedException accessDeniedException)
         {
-            Class<? extends ViewConfig> errorView;
-
             ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);
 
             ViewConfigDescriptor errorViewDescriptor = viewConfigResolver
@@ -130,11 +127,10 @@ public class SecurityAwareViewHandler extends ViewHandlerWrapper implements
Deac
                         .isAlwaysUseNavigationHandlerOnSecurityViolation())
                 {
                     SecurityUtils.tryToHandleSecurityViolation(accessDeniedException);
-                    errorView = errorViewDescriptor.getConfigClass();
                 }
                 else
                 {
-                    errorView = SecurityUtils.handleSecurityViolationWithoutNavigation(accessDeniedException);
+                    SecurityUtils.handleSecurityViolationWithoutNavigation(accessDeniedException);
                 }
             }
             finally
@@ -142,11 +138,6 @@ public class SecurityAwareViewHandler extends ViewHandlerWrapper implements
Deac
                 broadcastAccessDeniedException(accessDeniedException);
             }
 
-            if (errorViewDescriptor == null && errorView != null)
-            {
-                errorViewDescriptor = viewConfigResolver.getViewConfigDescriptor(errorView);
-            }
-
             if (errorViewDescriptor != null)
             {
                 return this.wrapped.createView(context, errorViewDescriptor.getViewId());

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/64a2eeb7/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java
index 7eeb24d..b7d6214 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/SecurityUtils.java
@@ -123,11 +123,10 @@ public abstract class SecurityUtils
      * Processes a security violation without triggering the navigation to the error page
      *
      * @param exception current exception
-     * @return error view which can be used e.g. for manual navigation
      */
-    public static Class<? extends ViewConfig> handleSecurityViolationWithoutNavigation(RuntimeException
exception)
+    public static void handleSecurityViolationWithoutNavigation(RuntimeException exception)
     {
-        return tryToHandleSecurityViolation(exception, false);
+        tryToHandleSecurityViolation(exception, false);
     }
 
     /**
@@ -140,8 +139,8 @@ public abstract class SecurityUtils
         tryToHandleSecurityViolation(exception, true);
     }
 
-    private static Class<? extends ViewConfig> tryToHandleSecurityViolation(RuntimeException
runtimeException,
-                                                                            boolean allowNavigation)
+    private static void tryToHandleSecurityViolation(RuntimeException runtimeException,
+                                                     boolean allowNavigation)
     {
         ErrorViewAwareAccessDeniedException exception = extractException(runtimeException);
 
@@ -176,7 +175,6 @@ public abstract class SecurityUtils
         }
 
         processApplicationSecurityException(exception, errorView, allowNavigation);
-        return errorView;
     }
 
     private static ErrorViewAwareAccessDeniedException extractException(Throwable exception)


Mime
View raw message