You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2025/06/24 11:54:11 UTC
(tomee) branch jdk24 updated (5c79e5b027 -> c3ad276ae8)
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a change to branch jdk24
in repository https://gitbox.apache.org/repos/asf/tomee.git
from 5c79e5b027 JDK 24?
new 3be8931c49 Revert "JDK 24?"
new c3ad276ae8 JDK 24?
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../core/security/AbstractSecurityService.java | 46 ++++++++++++----------
.../org/apache/openejb/loader/SystemInstance.java | 1 -
2 files changed, 26 insertions(+), 21 deletions(-)
(tomee) 02/02: JDK 24?
Posted by rz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch jdk24
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit c3ad276ae84306c6e75e44d0f5394decaadbb8cf
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Tue Jun 24 13:54:02 2025 +0200
JDK 24?
---
.../openejb/core/security/AbstractSecurityService.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
index 4c3a6ee78f..7893b339de 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
@@ -50,6 +50,7 @@ import java.security.Policy;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
+import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -375,8 +376,8 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se
public boolean isCallerAuthorized(final Method method, final InterfaceType type) {
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext beanContext = threadContext.getBeanContext();
- final String ejbName = beanContext.getEjbName();
try {
+ final String ejbName = beanContext.getEjbName();
String name = type == null ? null : type.getSpecName();
if ("LocalBean".equals(name) || "LocalBeanHome".equals(name)) {
name = null;
@@ -389,18 +390,21 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se
} else {
securityContext = new SecurityContext(currentIdentity.getSubject());
}
- securityContext.getAccessControlContext().checkPermission(new EJBMethodPermission(ejbName, name, method));
+ getPolicy().implies(newProtectionDomain(securityContext.subject.getPrincipals()), new EJBMethodPermission(ejbName, name, method));
} catch (final AccessControlException e) {
- if ("openejb/Deployer".equals(ejbName)
- || type == BUSINESS_LOCALBEAN_HOME
- || type == LOCALBEAN) {
- return true;
- }
return false;
}
return true;
}
+ private ProtectionDomain newProtectionDomain(Set<Principal> principalSet) {
+ return new ProtectionDomain(
+ new CodeSource(null, (Certificate[]) null),
+ null,
+ null,
+ principalSet == null ? null : principalSet.toArray(Principal[]::new));
+ }
+
protected static String autoJaccProvider() {
return SystemInstance.isInitialized() ?
SystemInstance.get().getProperty(JaccProvider.class.getName(), BasicJaccProvider.class.getName()) :
(tomee) 01/02: Revert "JDK 24?"
Posted by rz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch jdk24
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 3be8931c491a75214044f7271fa6a6e8e62b108f
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Tue Jun 24 13:44:59 2025 +0200
Revert "JDK 24?"
This reverts commit 5c79e5b0278907408cf194a7f225c737a96c2c92.
---
.../core/security/AbstractSecurityService.java | 44 +++++++++++-----------
.../org/apache/openejb/loader/SystemInstance.java | 1 -
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
index bf4818c6b4..4c3a6ee78f 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java
@@ -373,30 +373,32 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se
@Override
public boolean isCallerAuthorized(final Method method, final InterfaceType type) {
- if("true".equals(SystemInstance.get().getProperty("security.manager.available", "true"))) {
- final ThreadContext threadContext = ThreadContext.getThreadContext();
- final BeanContext beanContext = threadContext.getBeanContext();
- final String ejbName = beanContext.getEjbName();
- try {
- String name = type == null ? null : type.getSpecName();
- if ("LocalBean".equals(name) || "LocalBeanHome".equals(name)) {
- name = null;
- }
+ final ThreadContext threadContext = ThreadContext.getThreadContext();
+ final BeanContext beanContext = threadContext.getBeanContext();
+ final String ejbName = beanContext.getEjbName();
+ try {
+ String name = type == null ? null : type.getSpecName();
+ if ("LocalBean".equals(name) || "LocalBeanHome".equals(name)) {
+ name = null;
+ }
- final Identity currentIdentity = clientIdentity.get();
- final SecurityContext securityContext;
- if (currentIdentity == null) {
- securityContext = threadContext.get(SecurityContext.class);
- } else {
- securityContext = new SecurityContext(currentIdentity.getSubject());
- }
- securityContext.getAccessControlContext().checkPermission(new EJBMethodPermission(ejbName, name, method));
- } catch (final AccessControlException e) {
- return false;
+ final Identity currentIdentity = clientIdentity.get();
+ final SecurityContext securityContext;
+ if (currentIdentity == null) {
+ securityContext = threadContext.get(SecurityContext.class);
+ } else {
+ securityContext = new SecurityContext(currentIdentity.getSubject());
}
- return true;
+ securityContext.getAccessControlContext().checkPermission(new EJBMethodPermission(ejbName, name, method));
+ } catch (final AccessControlException e) {
+ if ("openejb/Deployer".equals(ejbName)
+ || type == BUSINESS_LOCALBEAN_HOME
+ || type == LOCALBEAN) {
+ return true;
+ }
+ return false;
}
- return true; // if the security manager is not available, we assume that the caller is authorized
+ return true;
}
protected static String autoJaccProvider() {
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
index 434c02a653..f690577740 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
@@ -131,7 +131,6 @@ public final class SystemInstance {
}
this.internalProperties.setProperty("openejb.home", homeDirCanonicalPath);
this.internalProperties.setProperty("openejb.base", baseDirCanonicalPath);
- this.internalProperties.setProperty("security.manager.available", Boolean.toString(System.getSecurityManager() != null));
System.setProperty("derby.system.home", System.getProperty("derby.system.home", baseDirCanonicalPath));
}