From 9ce47775266eb3ae3c2f2a8c618c255b33fa1da2 Mon Sep 17 00:00:00 2001 From: Tomasz Adamski Date: Wed, 13 Dec 2023 10:18:32 +0100 Subject: [PATCH 1/3] [WFTC-138] Add access checking API to TxnNamingContextFactory --- .../client/naming/txn/TxnNamingContext.java | 8 +++++++- .../client/naming/txn/TxnNamingContextFactory.java | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContext.java b/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContext.java index 57986a2..a79d8b2 100644 --- a/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContext.java +++ b/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContext.java @@ -52,13 +52,19 @@ class TxnNamingContext extends AbstractContext { private final ProviderEnvironment providerEnvironment; private final RemoteUserTransaction remoteUserTransaction; - TxnNamingContext(final NamingProvider namingProvider, final ProviderEnvironment providerEnvironment) { + private final TxnNamingContextFactory.AccessChecker accessChecker; + + TxnNamingContext(final NamingProvider namingProvider, final ProviderEnvironment providerEnvironment, final TxnNamingContextFactory.AccessChecker accessChecker) { this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; + this.accessChecker = accessChecker; remoteUserTransaction = getRemoteUserTransaction(); } protected Object lookupNative(final Name name) throws NamingException { + if (accessChecker != null) { + accessChecker.checkAccessAllowed(); + } final String str = name.get(0); switch (str) { case USER_TRANSACTION: { diff --git a/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContextFactory.java b/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContextFactory.java index 7e0e7d6..8318a91 100644 --- a/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContextFactory.java +++ b/src/main/java/org/wildfly/transaction/client/naming/txn/TxnNamingContextFactory.java @@ -34,11 +34,23 @@ */ @MetaInfServices public final class TxnNamingContextFactory implements NamingContextFactory { + + + private static AccessChecker accessChecker = null; + public boolean supportsUriScheme(final NamingProvider namingProvider, final String nameScheme) { return nameScheme != null && nameScheme.equals("txn"); } public Context createRootContext(final NamingProvider namingProvider, final String nameScheme, final FastHashtable env, final ProviderEnvironment providerEnvironment) throws NamingException { - return new TxnNamingContext(namingProvider, providerEnvironment); + return new TxnNamingContext(namingProvider, providerEnvironment, accessChecker); + } + + public static void setAccessChecker(final AccessChecker accessChecker) { + TxnNamingContextFactory.accessChecker = accessChecker; + } + + public interface AccessChecker { + void checkAccessAllowed() throws NamingException; } } From bf5bdd5aa335c1596d92026db715a0b21871654c Mon Sep 17 00:00:00 2001 From: Tomasz Adamski Date: Wed, 13 Dec 2023 10:31:59 +0100 Subject: [PATCH 2/3] Next is 3.0.4.Final --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7a7b203..783f456 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ org.wildfly.transaction wildfly-transaction-client - 3.0.2.Final-SNAPSHOT + 3.0.4.Final-SNAPSHOT WildFly Transaction Client Client library for applications using transactions with Wildfly - Jakarta EE Variant From bba9b19e56b5712e5052ff913f39fa2a701c47d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 09:35:46 +0000 Subject: [PATCH 3/3] Bump org.wildfly.common:wildfly-common from 1.6.0.Final to 1.7.0.Final Bumps [org.wildfly.common:wildfly-common](https://github.com/wildfly/wildfly-common) from 1.6.0.Final to 1.7.0.Final. - [Commits](https://github.com/wildfly/wildfly-common/compare/1.6.0.Final...1.7.0.Final) --- updated-dependencies: - dependency-name: org.wildfly.common:wildfly-common dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 783f456..3a843c5 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ 5.0.27.Final 3.8.10.Final 1.11 - 1.6.0.Final + 1.7.0.Final 2.2.2.Final 2.0.1.Final 1.6.Final