Project

General

Profile

« Previous | Next » 

Revision 9319

rollback: set session.subject so libclient can look up certificate. Seems like the default behavior may have changed?

View differences:

src/edu/ucsb/nceas/metacat/admin/D1Admin.java
40 40
import org.dataone.service.types.v2.NodeList;
41 41
import org.dataone.service.types.v1.NodeReference;
42 42
import org.dataone.service.types.v1.Session;
43
import org.dataone.service.types.v1.Subject;
44 43

  
45 44
import edu.ucsb.nceas.metacat.IdentifierManager;
46 45
import edu.ucsb.nceas.metacat.dataone.MNodeService;
......
438 437
        // check if this is new or an update
439 438
        boolean update = isNodeRegistered(node.getIdentifier().getValue());
440 439
        
441
        // Set DN so we can look up session in libclient
440
        // Session is null, because the libclient code automatically sets up an
441
        // SSL session for us using the client certificate provided
442 442
        Session session = null;
443
        try {
444
	        session = new Session();
445
	        Subject subject = new Subject();
446
	        subject.setValue(CertificateManager.getInstance().getSubjectDN(CertificateManager.getInstance().loadCertificateFromFile(mnCertificatePath)));
447
			session.setSubject(subject);
448
        } catch (Exception e) {
449
        	logMetacat.error("Could not set session subject using certificate location" + e.getMessage(), e);
450
        }
451
		
452 443
        if (update) {
453 444
        	logMetacat.debug("Updating node with DataONE. " + cn.getNodeBaseServiceUrl());
454 445
            boolean result = cn.updateNodeCapabilities(session, node.getIdentifier(), node);

Also available in: Unified diff