billbarker 2004/09/02 21:28:40 Modified: jk/java/org/apache/jk/common JkMX.java Log: Allow the mx4j HttpAdaptor to be configured for authentication. Submitted By: Rainer Jung [EMAIL PROTECTED] Revision Changes Path 1.25 +48 -1 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkMX.java Index: JkMX.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkMX.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- JkMX.java 30 Aug 2004 16:00:06 -0000 1.24 +++ JkMX.java 3 Sep 2004 04:28:39 -0000 1.25 @@ -46,6 +46,9 @@ private boolean enabled=false; private int httpport=-1; private String httphost="localhost"; + private String authmode="none"; + private String authuser=null; + private String authpassword=null; private int jrmpport=-1; private String jrmphost="localhost"; private boolean useXSLTProcessor = true; @@ -93,6 +96,30 @@ return httphost; } + public void setAuthMode(String mode) { + authmode=mode; + } + + public String getAuthMode() { + return authmode; + } + + public void setAuthUser(String user) { + authuser=user; + } + + public String getAuthUser() { + return authuser; + } + + public void setAuthPassword(String password) { + authpassword=password; + } + + public String getAuthPassword() { + return authpassword; + } + /** Enable the MX4J JRMP internal adapter */ public void setJrmpPort( int i ) { @@ -140,6 +167,16 @@ mserver.setAttribute(httpServerName, new Attribute("Host", httphost)); mserver.setAttribute(httpServerName, new Attribute("Port", new Integer(httpport))); + if( "none".equals(authmode) || "basic".equals(authmode) || "digest".equals(authmode) ) + mserver.setAttribute(httpServerName, new Attribute("AuthenticationMethod", authmode)); + + if( authuser!=null && authpassword!=null ) + mserver.invoke(httpServerName, "addAuthorization", + new Object[] { + authuser, + authpassword}, + new String[] { "java.lang.String", "java.lang.String" }); + if(useXSLTProcessor) { ObjectName processorName = registerObject("mx4j.adaptor.http.XSLTProcessor", "Http:name=XSLTProcessor"); @@ -169,7 +206,17 @@ mserver.setAttribute(httpServerName, new Attribute("Host", httphost)); mserver.setAttribute(httpServerName, new Attribute("Port", new Integer(httpport))); - if(useXSLTProcessor) { + if( "none".equals(authmode) || "basic".equals(authmode) || "digest".equals(authmode) ) + mserver.setAttribute(httpServerName, new Attribute("AuthenticationMethod", authmode)); + + if( authuser!=null && authpassword!=null ) + mserver.invoke(httpServerName, "addAuthorization", + new Object[] { + authuser, + authpassword}, + new String[] { "java.lang.String", "java.lang.String" }); + + if(useXSLTProcessor) { ObjectName processorName = registerObject("mx4j.tools.adaptor.http.XSLTProcessor", "Http:name=XSLTProcessor"); mserver.setAttribute(httpServerName, new Attribute("ProcessorName", processorName));
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]