From 79dbaac96331f318785cf54177477619d324496d Mon Sep 17 00:00:00 2001 From: Martin Haase <martin.haase@daasi.de> Date: Tue, 3 Aug 2010 08:42:10 +0000 Subject: [PATCH] VOMRS autoregistration class and driver, to be combined with the VOMRS soapclient libraries. git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@6865 7c539038-3410-0410-b1ec-0f2a7bf1c452 --- .../AutoReg/Autoreg.java | 49 +++++++++++++++++++ .../AutoReg/auth.properties | 3 ++ .../AutoReg/runAutoregClient.sh | 7 +++ 3 files changed, 59 insertions(+) create mode 100644 info.textgrid.middleware.tgauth.webauth/AutoReg/Autoreg.java create mode 100644 info.textgrid.middleware.tgauth.webauth/AutoReg/auth.properties create mode 100755 info.textgrid.middleware.tgauth.webauth/AutoReg/runAutoregClient.sh diff --git a/info.textgrid.middleware.tgauth.webauth/AutoReg/Autoreg.java b/info.textgrid.middleware.tgauth.webauth/AutoReg/Autoreg.java new file mode 100644 index 0000000..604b9da --- /dev/null +++ b/info.textgrid.middleware.tgauth.webauth/AutoReg/Autoreg.java @@ -0,0 +1,49 @@ +import fnal.vox.vomrs.client.SoapClient; +import java.util.Arrays; + +/** + * Class to Register Members at VOMRS automatically + */ +public class Autoreg +{ + public static void main(String [] args) throws Exception { + if (args.length < 7) { + System.out.println("Sorry, not enough information, cannot register"); + System.out.println("I want: subject_dn issuer_dn serialNumber email Firstname Lastname Phone"); + return; + } + String r_dn = args[0]; // subject_dn + String r_ca = args[1]; // issuer_dn + String r_sn = args[2]; // serialNumber + String r_in = "DAASI"; //"TextGridPortal"; // (institution) + String r_repdn = "/C=DE/ST=Bremen/L=Bremerhaven/O=AWI/OU=SLC-Gap Project/CN=TextGrid VOrepresentative/Email=martin.haase@daasi.de"; // + String r_repca = "/C=DE/ST=Bremen/L=Bremerhaven/O=SLC-Gap Project/OU=DAASI International GmbH/CN=SLC-Gap Test CA2"; // + String r_rights = "full"; // + String r_email = args[3]; // email + String r_confirm = "N"; // + String r_pi = "First name,"+args[4]+ ",Last name,"+args[5]+ ",Phone,"+args[6]; + + SoapClient sc = new SoapClient("https://voms.awi.de:8443/vomrs/tgtest1/services/VOMRS"); + + // getMembers + Object o = sc.execute("getMembers",new String[]{}); + String members[] = (String[]) o; + /* for (String s : members) { + System.out.println(s); + }*/ + + if (Arrays.asList(members).contains(r_dn)) + { + System.out.println("Member is already registered: " + r_dn); + return; + } + + Object o2 = sc.execute("registerMember", new String[]{r_dn, r_ca, r_sn, r_in, r_repdn, r_repca, r_rights, r_email, r_confirm, r_pi}); + // o2 is null, this execute() returns nothing + + Object o3 = sc.execute("setMbrRegistrationStatus", new String[]{r_dn, r_ca, "Approved", "Representative", "TextGrid-SLC Portal Approval"}); + // o3 null as well + + + } +} diff --git a/info.textgrid.middleware.tgauth.webauth/AutoReg/auth.properties b/info.textgrid.middleware.tgauth.webauth/AutoReg/auth.properties new file mode 100644 index 0000000..1effb14 --- /dev/null +++ b/info.textgrid.middleware.tgauth.webauth/AutoReg/auth.properties @@ -0,0 +1,3 @@ +sslCAFiles = /etc/grid-security/certificates/*.0 +sslKey = /var/www/.globus/userkey.pem +sslCertfile = /var/www/.globus/usercert.pem diff --git a/info.textgrid.middleware.tgauth.webauth/AutoReg/runAutoregClient.sh b/info.textgrid.middleware.tgauth.webauth/AutoReg/runAutoregClient.sh new file mode 100755 index 0000000..d899225 --- /dev/null +++ b/info.textgrid.middleware.tgauth.webauth/AutoReg/runAutoregClient.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +cd /usr/local/bin/VOMRSclient/bin + +export CLASSPATH="/usr/local/bin/VOMRSclient/lib/*:." + +java -Daxis.socketSecureFactory=org.glite.security.trustmanager.axis.AXISSocketFactory -DsslConfigFile=auth.properties Autoreg "$@" \ No newline at end of file -- GitLab