Project

General

Profile

Bug #2095

Request for access form doesn't work

Added by Jonathan Barber over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Start date:
06/06/2012
Due date:
% Done:

0%


Description

Form is at URL http://grid.fe.up.pt:8080/map/form/

Problem is with authentication component - it relies on a POST to:
https://sigarra.up.pt/feup/servicos.validacao?p_login=$username&p_passwd=$passwd&p_inst_sigla=FEUP

which doesn't seem to be available ATM.

Jorge suggested replacing it with a bind to the LDAP service instead.

LdapAuth.java View (3.09 KB) Jonathan Barber, 12/06/2012 19:44

History

#1 Updated by Jonathan Barber over 12 years ago

The file for the JSP is ibmcluster:/opt/map/map-4.5.0/tomcat/webapps/map/form/sendForm.jsp

#2 Updated by Jonathan Barber over 12 years ago

Replaced with call to Java routines for JNDI.

Created keystore for LDAPs:

cd /opt/map/map-4.5.0
openssl s_client -connect ldap.fe.up.pt:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem
/opt/jdk1.5.0_03/bin/keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem
rm cert.pem

Modified /opt/map/map-4.5.0/mapctl.sh to contain at top of file and restart service:

export JAVA_OPTS="-Djavax.net.ssl.trustStore=/opt/map/map-4.5.0/keystore -Djavax.net.ssl.trustStorePassword=changeit" 
/opt/map/map-4.5.0/mapctl.sh stop && /opt/map/map-4.5.0/mapctl.sh start)

Create LdapAuth class for doing ldap bind (see attachment) in file /opt/map/map-4.5.0/tomcat/webapps/map/WEB-INF/classes/pt/up/fe/LdapAuth.java. Compile with /opt/jdk1.5.0_03/bin/javac LdapAuth.java.

Modify /opt/map/map-4.5.0/tomcat/webapps/map/form/sendForm.jsp to use this class instead of calling the shell script, udiff is:

--- sendForm.jsp    2007-09-07 12:22:55.000000000 +0100
+++ sendForm_test.jsp    2012-06-12 19:42:34.000000000 +0100
@@ -1,2 +1,4 @@
-<%@ page import="java.util.*, java.text.SimpleDateFormat, java.io.*, javax.mail.*, javax.mail.internet.*, java.lang.*" errorPage="errorpage.jsp"%>
-
+<%@ page 
+  import="java.util.*, java.text.SimpleDateFormat, java.io.*, javax.mail.*, javax.mail.internet.*, java.lang.*, pt.up.fe.LdapAuth" 
+  errorPage="errorpage.jsp" 
+%>
@@ -69,3 +71 @@
-String faz = ("/opt/jakarta-tomcat-5/webapps/map/form/auth.sh "+login+" "+pass);
-Process res = java.lang.Runtime.getRuntime().exec(faz);
-DataInputStream s_in = new DataInputStream(res.getInputStream());
+
@@ -73,3 +73 @@
-        String ls_str;
-        if ((ls_str = s_in.readLine()) != null) {
-            //out.println("User autenticado!!!");
+        if ( LdapAuth.authenticate(login, pass) ) {

Tested with success.

#3 Updated by Jonathan Barber over 12 years ago

  • Status changed from New to Closed

Also available in: Atom PDF