You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by am...@apache.org on 2013/06/20 05:15:54 UTC

svn commit: r1494844 - /airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java

Author: amilaj
Date: Thu Jun 20 03:15:53 2013
New Revision: 1494844

URL: http://svn.apache.org/r1494844
Log:
Change security context to support some of the gram functionality tests

Modified:
    airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java

Modified: airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java?rev=1494844&r1=1494843&r2=1494844&view=diff
==============================================================================
--- airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java (original)
+++ airavata/sandbox/grid-tools/gsi-myproxy-client/src/main/java/org/apache/airavata/security/myproxy/SecurityContext.java Thu Jun 20 03:15:53 2013
@@ -40,6 +40,9 @@ public class SecurityContext {
     private MyProxyCredentials myProxyCredentials;
     private static final Logger log = Logger.getLogger(SecurityContext.class);
 
+    private String userName = null;
+    private String password = null;
+
     /**
      * 
      * Constructs a ApplicationGlobalContext.
@@ -53,6 +56,17 @@ public class SecurityContext {
 
     }
 
+    public SecurityContext(String user, String pwd) throws Exception {
+
+        this.userName = user;
+        this.password = pwd;
+
+        log.setLevel(org.apache.log4j.Level.INFO);
+        loadConfiguration();
+
+    }
+
+
     public static void main(String[] args) {
         try {
             SecurityContext myproxy = new SecurityContext();
@@ -124,14 +138,18 @@ public class SecurityContext {
                         this.myProxyCredentials.setMyProxyPortNumber(MyProxy.DEFAULT_PORT);
                     }
                     String myproxyuser = properties.getProperty(ServiceConstants.MYPROXY_USERNAME);
-                    if (myproxyuser != null) {
+                    if (userName != null) {
+                        this.myProxyCredentials.setMyProxyUserName(userName);
+                    } else {
                         this.myProxyCredentials.setMyProxyUserName(myproxyuser);
                     }
 
                     System.out.println("My proxy user name " + myproxyuser);
 
                     String myproxypass = properties.getProperty(ServiceConstants.MYPROXY_PASSWD);
-                    if (myproxypass != null) {
+                    if (password != null) {
+                        this.myProxyCredentials.setMyProxyPassword(password);
+                    } else {
                         this.myProxyCredentials.setMyProxyPassword(myproxypass);
                     }
 
@@ -171,6 +189,16 @@ public class SecurityContext {
     }
 
     /**
+     * Returns the raw gssCredential, without creating a proxy.
+     *
+     * @return The gssCredential
+     */
+    public GSSCredential getRawCredential() throws Exception{
+
+        return gssCredential;
+    }
+
+    /**
      * Returns the gssCredential.
      * 
      * @return The gssCredential