Skip to content

Commit

Permalink
LDEV-3079 - remove dependence on com.sun on classes no longer exist i…
Browse files Browse the repository at this point in the history
…n java 21
  • Loading branch information
michaeloffner committed Oct 14, 2024
1 parent bb6466d commit 2e3ae7e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 27 deletions.
2 changes: 0 additions & 2 deletions core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ public final class CFMLEngineImpl implements CFMLEngine {

static {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("javax.xml.bind.context.factory", "com.sun.xml.bind.v2.ContextFactory");

}

public static final PrintStream CONSOLE_ERR = System.err;
Expand Down
11 changes: 1 addition & 10 deletions core/src/main/java/lucee/runtime/functions/xml/XmlSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,7 @@
* Implements the CFML Function xmlsearch
*/
public final class XmlSearch implements Function {
/*
* static { System.setProperty("-Dorg.apache.xml.dtm.DTMManager",
* "org.apache.xml.dtm.ref.DTMManagerDefault"); System.setProperty("org.apache.xml.dtm.DTMManager",
* "org.apache.xml.dtm.ref.DTMManagerDefault");
* System.setProperty("-Dcom.sun.org.apache.xml.internal.dtm.DTMManager",
* "com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault");
* System.setProperty("com.sun.org.apache.xml.internal.dtm.DTMManager",
* "com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault"); }
*/
private static final long serialVersionUID = 5770611088309897382L;
static final long serialVersionUID = 5770611088309897382L;

private static List<String> operators = new ArrayList<String>();

Expand Down
25 changes: 12 additions & 13 deletions core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
package lucee.runtime.net.ldap;

import java.io.IOException;
import java.security.Provider;
import java.security.Security;
import java.util.Enumeration;
import java.util.Hashtable;

Expand All @@ -38,7 +36,6 @@
import javax.naming.ldap.InitialLdapContext;

import lucee.commons.lang.ClassException;
import lucee.commons.lang.ClassUtil;
import lucee.commons.lang.StringUtil;
import lucee.runtime.exp.PageException;
import lucee.runtime.op.Caster;
Expand Down Expand Up @@ -127,33 +124,35 @@ public void setCredential(String username, String password) {
}

/**
* sets the secure Level
* Sets the secure level for the LDAP connection.
*
* @param secureLevel [SECURE_CFSSL_BASIC, SECURE_CFSSL_CLIENT_AUTH, SECURE_NONE]
* @throws ClassNotFoundException
* @throws ClassException
*/
public void setSecureLevel(short secureLevel) throws ClassException {
// Security
// SSL basic security level
if (secureLevel == SECURE_CFSSL_BASIC) {
// Enabling SSL protocol for the connection
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");/* JAVJAK */
Class clazz = ClassUtil.loadClass("com.sun.net.ssl.internal.ssl.Provider");

try {
Security.addProvider((Provider) ClassUtil.newInstance(clazz));
}
catch (Exception e) {
throw new RuntimeException(e);
}
// Using the standard Java SSLSocketFactory for secure connections
env.put("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");

// SSL client authentication level
}
else if (secureLevel == SECURE_CFSSL_CLIENT_AUTH) {
// Enabling SSL protocol and setting external client authentication
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.security.authentication", "EXTERNAL");

// No security (simple authentication)
}
else {
// Default simple authentication, no SSL
env.put("java.naming.security.authentication", "simple");

// Removing security-related configurations if not using SSL
env.remove("java.naming.security.protocol");
env.remove("java.naming.ldap.factory.socket");
}
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.1.1.97-SNAPSHOT"/>
<property name="version" value="6.1.1.98-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.1.1.97-SNAPSHOT</version>
<version>6.1.1.98-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 2e3ae7e

Please sign in to comment.