code: public static Subject createSubject(GSSName name, GSSCredential cred)
  	throws GSSException {
  	if (cred == null && name == null) {
  	    return null;
  	}
  	Subject subject = new Subject();
  	if (cred != null) {
  	    subject.getPrivateCredentials().add(cred);
  	    if (name == null) {
  		GlobusPrincipal nm = toGlobusPrincipal(cred.getName());
  		subject.getPrincipals().add(nm);
  	    }
  	}
  	if (name != null) {
  	    GlobusPrincipal nm = toGlobusPrincipal(name);
  	    subject.getPrincipals().add(nm);
  	}
  
  	return subject;
      }
docs: Creates a new <code>Subject</code> object from specified
  <code>GSSCredential</code> and <code>GSSName</code>.
  If the GSSCredential is specified it is added
  to the private credential set of the Subject object.
  Also, if the GSSCredential.getName() is of type <code>
  org.globus.gsi.gssapi.GlobusGSSName</code> and the
  GSSName parameter was not specified a
  <code>org.globus.gsi.jaas.GlobusPrincipal</code>
  is added to the principals set of the Subject object.
  If the GSSName parameter was specified of type
  <code>org.globus.gsi.gssapi.GlobusGSSName</code> a
  <code>org.globus.gsi.jaas.GlobusPrincipal</code>
  is added to the principals set of the Subject object.