? lib/gsi
? lib/cog-url-ncsa.jar
? lib/cog-jglobus-ncsa.jar
? src/gsimap.properties
? src/edu/ucsb/nceas/metacat/AuthGsi.java
? src/edu/ucsb/nceas/metacat/AuthInfo.java
? src/edu/ucsb/nceas/metacat/GsiMapfile.java
? src/edu/ucsb/nceas/metacat/client/gsi
Index: build.properties
===================================================================
RCS file: /cvs/metacat/build.properties,v
retrieving revision 1.16
diff -r1.16 build.properties
85a86,100
>
> # Authentication options -- written into metacat.properties
> # can be "Gsi" or "Ldap"
> auth-method=Gsi
> # can really only be "Ldap" for now
> auth-delegate=Ldap
> # can be "true" or "false"
> auth-delegation-allowed=true
> # can be "username+password" or "gss"
> auth-precedence=username+password
>
> # Should logins from localhost with no password be trusted? Useful
> # for the GT4 web service wrapper around metacat when it isn't using
> # GSI delegation.
> auth-trust-localhost=true
Index: build.xml
===================================================================
RCS file: /cvs/metacat/build.xml,v
retrieving revision 1.226
diff -r1.226 build.xml
273a274,278
>
> > | >
> Overview > >> As an alternative to username/password, Metacat can use Grid > Security Infrastructure (GSI) credentials for authentication, if > you are programming to the Metacat client API. The advantages > are: > > >
Grid Security Setup > >
Tomcat Configuration > >
Metacat Client GSI Login > >
A Client Inside of Tomcat > >Detailed explanation: The sample code above will work in a simple > testing situation such as in an IDE's debugger, and it may work in a > desktop application, but it won't work inside Tomcat. It has two > problems, both of which have to do with Java's protocol handling > facilities. The first problem is a protocol handler collision -- > Tomcat has already instantiated an HTTPS handler, and it is not the > one we need for GSI+HTTPS. The second problem has to do with class > loading: our special HTTPS protocol handlers are not accessible to > Java's protocol handling code because they are not loaded by > Tomcat's root classloader. > >
|
>
Log in to a Metacat server using a Grid Security Infrastructure (GSI) > * credential to establish an HTTPS connection. Instead of authenticating > * the user via username and password, the user's identity will be > * extracted from the credential's Distinguished Name (DN).
> * > *Note that some installations will not have the necessary libraries to > * run GSI, and therefore we need to be able to run the non-GSI Metacat > * client even if those JARs are absent -- catching NoClassDefFoundError, > * etc.
> * > * @return the response string from metacat in XML format > * @throws MetacatAuthException when the client certificate is missing or > * is not trusted or represents a user who is unknown or not authorized to > * log in, or if the underlying connection is HTTP instead of HTTPS. > * @throws UnsupportedOperationException if this client does not support > * GSI-HTTPS. > */ > public String login(GSSCredential credential) > throws MetacatAuthException, MetacatInaccessibleException; > > /** > * Log in over a trusted connection (usually localhost HTTP) with just > * a username to identify the user. The server will only allow this login > * method if it is configured to fully trust incoming connections from this > * client. > * > *This may be used, depending on the server's configuration, with > * a PKI Distinguished Name (DN), or with an LDAP name.
> */ > public String login(String username) throws MetacatInaccessibleException, MetacatAuthException; > > /** 148d181 < * @param xmlDocument a Reader for accessing the document to be inserted 238c271 < * @returns the sessionId as a String, or null if the session is invalid --- > * @return the sessionId as a String, or null if the session is invalid 248c281 < * @param String the sessionId from a previously established session --- > * @param sessionId the session ID from a previously established session Index: src/edu/ucsb/nceas/metacat/client/MetacatClient.java =================================================================== RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/client/MetacatClient.java,v retrieving revision 1.18 diff -r1.18 MetacatClient.java 27,36d26 < import java.io.BufferedReader; < import java.io.InputStream; < import java.io.InputStreamReader; < import java.io.PushbackReader; < import java.io.IOException; < import java.io.StringWriter; < import java.io.Reader; < import java.net.URL; < import java.util.Properties; < 39c29,34 < import java.io.File; --- > import edu.ucsb.nceas.metacat.client.gsi.MetacatGsiClient; > import org.ietf.jgss.GSSCredential; > > import java.io.*; > import java.net.URL; > import java.util.Properties; 49,50c44,45 < /** The URL string for the metacat server */ < private String metacatUrl; --- > /** The URL string for the metacat server */ > private String metacatUrl; 52,53c47,48 < /** The session identifier for the session */ < private String sessionId; --- > /** The session identifier for the session */ > private String sessionId; 55,802c50,839 < /** < * Constructor to create a new instance. Protected because instances < * should only be created by the factory MetacatFactory. < */ < protected MetacatClient() < { < this.metacatUrl = null; < this.sessionId = null; < } < < /** < * Method used to log in to a metacat server. Implementations will need < * to cache a cookie value to make the session persistent. Each time a < * call is made to one of the other methods (e.g., read), the cookie will < * need to be passed back to the metacat server along with the request. < * < * @param username the username of the user, like an LDAP DN < * @param password the password for that user for authentication < * @return the response string from metacat in XML format < * @throws MetacatAuthException when the username/password could < * not be authenticated < */ < public String login(String username, String password) < throws MetacatAuthException, MetacatInaccessibleException < { < Properties prop = new Properties(); < prop.put("action", "login"); < prop.put("qformat", "xml"); < prop.put("username", username); < prop.put("password", password); < < String response = null; < try { < response = sendDataForString(prop, null, null, 0); < } catch (Exception e) { < throw new MetacatInaccessibleException(e.getMessage()); < } < < if (response.indexOf("This may be used, depending on the server's configuration, with > * a PKI Distinguished Name (DN), or with an LDAP name.
> */ > public String login(String username) > throws MetacatInaccessibleException, MetacatAuthException > { > return login(username, null); > } > > /** > * Method used to log out a metacat server. The Metacat server will end > * the session when this call is invoked. > * > * @return the response string from metacat in XML format > * @throws MetacatInaccessibleException when the metacat server can not be > * reached or does not respond > */ > public String logout() throws MetacatInaccessibleException, MetacatException > { > Properties prop = new Properties(); > prop.put("action", "logout"); > prop.put("qformat", "xml"); > > String response = null; > try { > response = sendDataForString(prop, null, null, 0); > } catch (Exception e) { > throw new MetacatInaccessibleException(e); > } > > if (response.indexOf("