This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/deltaspike.git
The following commit(s) were added to refs/heads/master by this push:
new af17ccab4 fixed JSF impl
af17ccab4 is described below
commit af17ccab42a0f9c8a7ef848303dceb250e9a8f5d
Author: Thomas Andraschko <[email protected]>
AuthorDate: Thu Mar 30 17:03:10 2023 +0200
fixed JSF impl
---
.../control/BridgeExceptionHandlerWrapper.java | 25 -----------
.../security/AccessDeniedExceptionBroadcaster.java | 52 ----------------------
.../impl/security/SecurityAwareViewHandler.java | 35 +++------------
...ion => jakarta.enterprise.inject.spi.Extension} | 0
deltaspike/modules/jsf/pom.xml | 2 -
5 files changed, 7 insertions(+), 107 deletions(-)
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/exception/control/BridgeExceptionHandlerWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/exception/control/BridgeExceptionHandlerWrapper.java
index 67efb38ed..4e80f6815 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/exception/control/BridgeExceptionHandlerWrapper.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/exception/control/BridgeExceptionHandlerWrapper.java
@@ -31,7 +31,6 @@ import jakarta.faces.event.PhaseId;
import jakarta.faces.event.SystemEvent;
import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
-import
org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;
import org.apache.deltaspike.core.spi.activation.Deactivatable;
import org.apache.deltaspike.jsf.impl.util.JsfUtils;
import org.apache.deltaspike.jsf.impl.util.SecurityUtils;
@@ -85,18 +84,6 @@ public class BridgeExceptionHandlerWrapper extends
ExceptionHandlerWrapper imple
iterator.remove();
continue;
}
- else
- {
- ExceptionToCatchEvent event = new
ExceptionToCatchEvent(rootCause, exceptionQualifier);
- event.setOptional(true);
-
- beanManager.fireEvent(event);
-
- if (event.isHandled())
- {
- iterator.remove();
- }
- }
// a handle method might redirect and set responseComplete
if (context.getResponseComplete())
@@ -134,18 +121,6 @@ public class BridgeExceptionHandlerWrapper extends
ExceptionHandlerWrapper imple
{
processAccessDeniedException(exception);
}
- else
- {
- ExceptionToCatchEvent exceptionToCatchEvent = new
ExceptionToCatchEvent(exception);
- exceptionToCatchEvent.setOptional(true);
-
- this.beanManager.fireEvent(exceptionToCatchEvent);
-
- if (exceptionToCatchEvent.isHandled())
- {
- return;
- }
- }
}
}
super.processEvent(event);
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/AccessDeniedExceptionBroadcaster.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/AccessDeniedExceptionBroadcaster.java
deleted file mode 100644
index e719543c7..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/security/AccessDeniedExceptionBroadcaster.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.security;
-
-import
org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent;
-import org.apache.deltaspike.security.api.authorization.AccessDeniedException;
-
-import jakarta.enterprise.context.Dependent;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.inject.Inject;
-
-//allows to customize the default handling
-@Dependent
-public class AccessDeniedExceptionBroadcaster
-{
- @Inject
- private BeanManager beanManager;
-
- public Throwable broadcastAccessDeniedException(AccessDeniedException
accessDeniedException)
- {
- ExceptionToCatchEvent exceptionToCatchEvent = new
ExceptionToCatchEvent(accessDeniedException);
-
- try
- {
- this.beanManager.fireEvent(exceptionToCatchEvent);
- }
- catch (AccessDeniedException e)
- {
- //intentionally ignore the exception per default, since we just
notify the handlers
- //(like in the other cases with AccessDeniedException)
- //that's different from the normal exception-control handling
- return null;
- }
- return null;
- }
-}
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 849e623e7..343db5351 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
@@ -23,7 +23,6 @@ import
org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.apache.deltaspike.core.spi.activation.Deactivatable;
import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.ExceptionUtils;
import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
import org.apache.deltaspike.jsf.api.config.view.View;
import org.apache.deltaspike.jsf.impl.util.SecurityUtils;
@@ -119,23 +118,16 @@ public class SecurityAwareViewHandler extends
ViewHandlerWrapper implements Deac
ViewConfigDescriptor errorViewDescriptor = viewConfigResolver
.getViewConfigDescriptor(accessDeniedException.getErrorView());
- try
+ if (errorViewDescriptor != null && View.NavigationMode.REDIRECT ==
+
errorViewDescriptor.getMetaData(View.class).iterator().next().navigation()
/*always available*/ &&
+ BeanProvider.getContextualReference(JsfModuleConfig.class)
+ .isAlwaysUseNavigationHandlerOnSecurityViolation())
{
- if (errorViewDescriptor != null &&
View.NavigationMode.REDIRECT ==
-
errorViewDescriptor.getMetaData(View.class).iterator().next().navigation()
/*always available*/ &&
- BeanProvider.getContextualReference(JsfModuleConfig.class)
- .isAlwaysUseNavigationHandlerOnSecurityViolation())
- {
-
SecurityUtils.tryToHandleSecurityViolation(accessDeniedException);
- }
- else
- {
-
SecurityUtils.handleSecurityViolationWithoutNavigation(accessDeniedException);
- }
+
SecurityUtils.tryToHandleSecurityViolation(accessDeniedException);
}
- finally
+ else
{
- broadcastAccessDeniedException(accessDeniedException);
+
SecurityUtils.handleSecurityViolationWithoutNavigation(accessDeniedException);
}
if (errorViewDescriptor != null)
@@ -169,19 +161,6 @@ public class SecurityAwareViewHandler extends
ViewHandlerWrapper implements Deac
return result;
}
- protected void
broadcastAccessDeniedException(ErrorViewAwareAccessDeniedException
accessDeniedException)
- {
- AccessDeniedExceptionBroadcaster exceptionBroadcaster =
-
BeanProvider.getContextualReference(AccessDeniedExceptionBroadcaster.class);
-
- Throwable broadcastResult =
exceptionBroadcaster.broadcastAccessDeniedException(accessDeniedException);
-
- if (broadcastResult != null)
- {
- throw ExceptionUtils.throwAsRuntimeException(broadcastResult);
- }
- }
-
private synchronized void lazyInit()
{
if (this.securityModuleActivated != null)
diff --git
a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension
similarity index 100%
rename from
deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
rename to
deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension
diff --git a/deltaspike/modules/jsf/pom.xml b/deltaspike/modules/jsf/pom.xml
index 9f4935508..c5dd83e9c 100644
--- a/deltaspike/modules/jsf/pom.xml
+++ b/deltaspike/modules/jsf/pom.xml
@@ -36,9 +36,7 @@
<modules>
<module>api</module>
- <!--
<module>impl</module>
- -->
</modules>
<dependencies>