• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProxyUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中gov.nih.nci.cagrid.common.security.ProxyUtil的典型用法代码示例。如果您正苦于以下问题:Java ProxyUtil类的具体用法?Java ProxyUtil怎么用?Java ProxyUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProxyUtil类属于gov.nih.nci.cagrid.common.security包,在下文中一共展示了ProxyUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: lookupHostCertificates

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
private void lookupHostCertificates() {
    try {
        getRegister().setEnabled(false);
        getProgress().showProgress("Finding hosts....");
        Thread.sleep(200);
        List<DorianHandle> services = ServicesManager.getInstance().getDorianServices();
        for (int j = 0; j < services.size(); j++) {
            DorianHandle handle = services.get(j);
            GridUserClient client = handle.getUserClient(ProxyUtil.getDefaultProxy());
            List<HostCertificateRecord> records = client.getOwnedHostCertificates();
            for (int i = 0; i < records.size(); i++) {
                if (records.get(i).getStatus().equals(HostCertificateStatus.Active)) {
                    getHostCertificates().addHostCertificate(records.get(i));
                }
            }
        }
        getProgress().stopProgress();
        getRegister().setEnabled(true);
    } catch (Exception e) {
        getProgress().stopProgress();
        ErrorDialog.showError(Utils.getExceptionMessage(e), e);
        dispose();

    }

}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:27,代码来源:RegistrationWindow.java


示例2: register

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
private void register() {
    try {
        getRegister().setEnabled(false);
        getProgress().showProgress("Registering for tutorial....");
        PhotoSharingRegistrationClient client = new PhotoSharingRegistrationClient(
            org.cagrid.tutorials.photosharing.Utils.getRegistrationService(), ProxyUtil.getDefaultProxy());
        client.registerPhotoSharingService(CertUtil.subjectToIdentity(getHostCertificates()
            .getSelectedHostCertificate().getSubject()));
        getProgress().stopProgress();
        getRegister().setEnabled(true);
        dispose();
        GridApplication.getContext().showMessage(
            "Congratulations you have successfully registered for the photo sharing tutorial.");
    } catch (Exception e) {
        getProgress().stopProgress();
        ErrorDialog.showError(Utils.getExceptionMessage(e), e);
        getRegister().setEnabled(true);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:20,代码来源:RegistrationWindow.java


示例3: getLocalCredential

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public static GlobusCredential getLocalCredential(String currentProxyFile) throws Exception 
{
	GlobusCredential credential = null;
	if(currentProxyFile!=null)
	{
		credential = ProxyUtil.loadProxy(currentProxyFile);			
	}
	else
	{
		credential = ProxyUtil.getDefaultProxy();
	}
	if(credential == null)
	{
		throw new Exception("Unable to get the local credential. \nPlease creat a valid proxy in the default location \nor give a path to the proxy file.");
	}
	return credential;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:TavernaWorkflowServiceClient.java


示例4: setDelegatedCredential

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public void setDelegatedCredential(DelegatedCredentialReference delegatedCredentialReference) throws RemoteException, gov.nih.nci.cagrid.workflow.service.impl.stubs.types.CannotSetCredential {
	
	try {
		
		GlobusCredential delegatedCredential = 
			validateAndRetrieveDelegatedCredential(delegatedCredentialReference);
        
		//Save the delegated credential in a custom location.
		String proxyPath = this.getTempDir() + File.separator + "delegatedProxy";
		LOG.info("ProxyPath : " + proxyPath);
		ProxyUtil.saveProxy(delegatedCredential, proxyPath);
		
		//Sets the TWS_USER_PROXY variable that indicates a user has delegated his proxy.
		this.setTWS_USER_PROXY(proxyPath);
	} catch (Exception e) {
		e.printStackTrace();
		throw new RemoteException("Error: Failed to setup the Delegated Credential on the Server.");
	}
			
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:21,代码来源:TavernaWorkflowServiceImplResource.java


示例5: getProxyIdentity

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public String getProxyIdentity() {
    if (getProxy() != null) {
        return getProxy().getIdentity();
    } else if (!isAnonymousPrefered()) {
        try {
            GlobusCredential cred = ProxyUtil.getDefaultProxy();
            if (cred.getTimeLeft() > 0) {
                return cred.getIdentity();
            }
        } catch (Exception e) {
            // TODO: handle exception
        }
        return null;
    } else {
        return null;
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:GridGrouperClient.java


示例6: setProxy

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public void setProxy(ProxyCredential proxy) throws Exception {
    if (proxy != null) {
        certificateLocation = null;
        privateKeyLocation = null;
        proxyLocation = proxy.getProxyLocation();
        try {
            proxyPanel.clearCredential();
            proxyPanel.showCredential(ProxyUtil.loadProxy(proxyLocation));
        } catch (Exception e) {
            CompositeErrorDialog.showErrorDialog("Invalid proxy specified!!!");
        }
        syncServiceCredentials();
        synchRunAsMode();
    }

}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:17,代码来源:ServiceSecurityPanel.java


示例7: GridGrouperExpressionEditor

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public GridGrouperExpressionEditor(List gridGrouperURIs,
		boolean loadOnStartup, MembershipExpression expression) {
	super();
	this.gridGrouperURIs = gridGrouperURIs;
	this.expression = expression;
	initialize();
	if ((loadOnStartup) && (gridGrouperURIs != null)
			&& (gridGrouperURIs.size() > 0)) {
		GlobusCredential cred = null;
		try {
			cred = ProxyUtil.getDefaultProxy();
			if (cred.getTimeLeft() <= 0) {
				cred = null;
			}
		} catch (Exception e) {

		}
		this.getGrouperTree().addGridGrouper(
				(String) gridGrouperURIs.get(0), cred);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:22,代码来源:GridGrouperExpressionEditor.java


示例8: getSetDefaultProxyButton

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
/**
 * This method initializes setDefaultProxy
 * 
 * @return javax.swing.JButton
 */
private JButton getSetDefaultProxyButton() {
    if (setDefaultProxyButton == null) {
        setDefaultProxyButton = new JButton();
        setDefaultProxyButton.setText("Set Default");
        setDefaultProxyButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    X509CredentialEntry cred = getProxyComboBox().getSelectedCredential();
                    if (cred != null) {
                        ProxyUtil.saveProxyAsDefault(cred.getCredential());
                        getProxyComboBox().handleDefaultCredential(true);
                        GridApplication.getContext().showMessage("Selected proxy saved as the default");
                    }
                } catch (Exception ex) {
                    ErrorDialog.showError("An unexpected error occurred in saving the currently selected proxy!!!",
                        ex);
                    log.error("An unexpected error occurred in saving the currently selected proxy!!!", ex);
                }
            }
        });
    }
    return setDefaultProxyButton;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:29,代码来源:CredentialManagerComponent.java


示例9: getDeleteCredentialButton

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
/**
 * This method initializes deleteProxy
 * 
 * @return javax.swing.JButton
 */
private JButton getDeleteCredentialButton() {
    if (deleteCredentialButton == null) {
        deleteCredentialButton = new JButton();
        deleteCredentialButton.setText("Delete Credential");
        deleteCredentialButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                    X509CredentialEntry cred = getProxyComboBox().getSelectedCredential();
                    if (cred != null) {
                        proxyInfoPanel.clearCredential();
                        CredentialManager.getInstance().deleteCredential(cred);
                        if (cred.isDefault()) {
                            // TODO: Check that this is true;
                            ProxyUtil.destroyDefaultProxy();
                        }
                        getProxyComboBox().populateList();
                    }
                } catch (Exception ex) {
                    log.error(ex, ex);
                }
            }
        });
    }
    return deleteCredentialButton;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:31,代码来源:CredentialManagerComponent.java


示例10: getGridIdentity

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
/**
 * This method initializes gridIdentity
 * 
 * @return javax.swing.JTextField
 */
private JTextField getGridIdentity() {
    if (gridIdentity == null) {
        gridIdentity = new JTextField();
        gridIdentity.setEditable(false);
        try {
            gridIdentity.setText(ProxyUtil.getDefaultProxy().getIdentity());
        } catch (Exception e) {
            gridIdentity.setText("");
        }

    }
    return gridIdentity;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:19,代码来源:RegistrationWindow.java


示例11: runStep

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
@Override
public void runStep() throws Throwable {
	BasicAuthentication authCred = new BasicAuthentication();
	authCred.setUserId(this.userId);
	authCred.setPassword(this.password);
	AuthenticationClient client = new AuthenticationClient(this.serviceURL);
	this.saml = client.authenticate(authCred);

	GridUserClient c2 = new GridUserClient(this.serviceURL);
	this.credential = c2.requestUserCertificate(this.saml, new CertificateLifetime(this.hours, 0, 0));
	ProxyUtil.saveProxyAsDefault(this.credential);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:13,代码来源:DorianAuthenticateStep.java


示例12: runStep

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
@Override
public void runStep() throws Exception {
	
	String credsPath = testInfo.getGridCertsPath() + File.separator;
	
	// User A: /O=osu/CN=testing user
	// User B: /O=osu/CN=testing user 2
	// User C: /O=osu/CN=testing user 3
	
	testInfo.setUserA(ProxyUtil.loadProxy(credsPath + "user.proxy"));
	testInfo.setUserB(ProxyUtil.loadProxy(credsPath + "user2.proxy"));
	testInfo.setUserC(ProxyUtil.loadProxy(credsPath + "user3.proxy"));
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:14,代码来源:LoadUserCredentialsStep.java


示例13: runStep

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
@Override
public void runStep() throws Throwable {
	BasicAuthentication authCred = new BasicAuthentication();
	authCred.setUserId(this.userId);
	authCred.setPassword(this.password);
	AuthenticationClient client = new AuthenticationClient(this.serviceURL);
	this.saml = client.authenticate(authCred);

	GridUserClient c2 = new GridUserClient(this.serviceURL);
	this.credential = c2.requestUserCertificate(this.saml, new CertificateLifetime(
			this.hours, 0, 0));
	ProxyUtil.saveProxyAsDefault(this.credential);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:14,代码来源:DorianAuthenticateStep.java


示例14: findMyDelegatedCredentials

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
/**
 * This method allows a user to find credentials that they delegated.
 * 
 * @param filter
 *            Search criteria to use in finding delegated credentials
 * @return A list of records each representing a credential delegated by the
 *         user
 * @throws RemoteException
 * @throws CDSInternalFault
 * @throws DelegationInternalFault
 * @throws PermissionDeniedFault
 */

public List<DelegationRecord> findMyDelegatedCredentials(
		DelegationRecordFilter filter) throws RemoteException,
		CDSInternalFault, DelegationFault, PermissionDeniedFault {
	if (filter == null) {
		filter = new DelegationRecordFilter();
	}
	if (cred != null) {
		filter.setGridIdentity(cred.getIdentity());
	} else {
		try {
			GlobusCredential c = ProxyUtil.getDefaultProxy();
			if (c != null) {
				filter.setGridIdentity(c.getIdentity());
			}
		} catch (Exception e) {
			DelegationFault f = new DelegationFault();
			f.setFaultString(e.getMessage());
			throw f;
		}
	}

	if (filter.getGridIdentity() == null) {
		throw Errors
				.getPermissionDeniedFault(Errors.AUTHENTICATION_REQUIRED);
	}

	DelegationRecord[] records = client.findDelegatedCredentials(filter);
	if (records == null) {
		return new ArrayList<DelegationRecord>();
	} else {
		List<DelegationRecord> list = Arrays.asList(records);
		return list;
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:48,代码来源:DelegationUserClient.java


示例15: AccountProfileWindow

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
/**
 * This is the default constructor
 */
public AccountProfileWindow() {
    super();
    try {

        GlobusCredential cred = ProxyUtil.getDefaultProxy();
        X509CredentialEntry defaultCredential = CredentialEntryFactory.getEntry(cred);
        defaultCredential = CredentialManager.getInstance().setDefaultCredential(defaultCredential);
        if (defaultCredential instanceof DorianUserCredentialEntry) {
            DorianUserCredentialEntry entry = (DorianUserCredentialEntry) defaultCredential;
            DorianHandle handle = ServicesManager.getInstance().getDorianHandle(entry.getDorianURL());
            if (handle == null) {
                throw new Exception("Cannot determine the connection information for " + entry.getDorianURL() + ".");
            }
            this.session = new DorianSession(handle, entry.getCredential());
            this.profile = this.session.getLocalUserClient().getAccountProfile();
            this.modificationAllowed = session.getHandle().localAccountModification();
        } else {
            throw new Exception("The account manager for your credential could not be determined.");
        }
    } catch (Exception e) {
        ErrorDialog.showError(e);
        FaultUtil.logFault(log, e);
        dispose();
    }
    initialize();
    this.setFrameIcon(DorianLookAndFeel.getUserIcon());
    setActiveComponents(true);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:32,代码来源:AccountProfileWindow.java


示例16: handleDefaultCredential

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public void handleDefaultCredential(boolean setSelected) {
    X509CredentialEntry defaultCredential = null;
    try {
        GlobusCredential cred = ProxyUtil.getDefaultProxy();
        defaultCredential = CredentialEntryFactory.getEntry(cred);
        defaultCredential = CredentialManager.getInstance().setDefaultCredential(defaultCredential);

    } catch (Exception ex) {

    }
    populateList();
    if ((setSelected) && (defaultCredential != null)) {
        setSelectedItem(defaultCredential);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:16,代码来源:CredentialComboBox.java


示例17: PhotoSharingHandle

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public PhotoSharingHandle(ServiceDescriptor des) throws Exception {
    super(des);
    cred = ProxyUtil.getDefaultProxy();
    client = new PhotoSharingClient(des.getServiceURL(), cred);
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:6,代码来源:PhotoSharingHandle.java


示例18: runStep

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public void runStep() 
	throws Throwable
{
	ProxyUtil.destroyDefaultProxy();
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:6,代码来源:DorianDestroyDefaultProxyStep.java


示例19: main

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public static void main(String[] args) {
    System.out.println("Running the Grid Service Client");
    try {
        if (!(args.length < 2)) {
            if (args[0].equals("-url")) {
                org.globus.common.CoGProperties properties = org.globus.common.CoGProperties.getDefault();
                properties.setCaCertLocations(".");
                org.globus.common.CoGProperties.setDefault(properties);

                GlobusCredential creds = null;
                GlobusCredential anothercreds = null;
                try {
                    creds = ProxyUtil.loadProxy("user.proxy");
                    anothercreds = ProxyUtil.loadProxy("user2.proxy");
                    System.out.println("Using proxy with id= " + creds.getIdentity() + " and lifetime "
                        + creds.getTimeLeft());
                } catch (Exception e1) {
                    System.out.println("No proxy file loaded so running with no credentials");
                }
                TransferSystemTestClient client = new TransferSystemTestClient(args[1], creds);
                // place client calls here if you want to use this main as a
                // test....
                System.out.println("Creating transfer context");
                org.cagrid.transfer.context.stubs.types.TransferServiceContextReference tref = client
                    .createStreamingTransferMethodStep();

                System.out.println("retrieving transfer descriptor");
                org.cagrid.transfer.context.client.TransferServiceContextClient tclient = new org.cagrid.transfer.context.client.TransferServiceContextClient(
                    tref.getEndpointReference(), creds);

                System.out.println("getting handle to data transfer descriptor");
                org.cagrid.transfer.descriptor.DataTransferDescriptor desc = tclient.getDataTransferDescriptor();
                
                
                while(!tclient.getStatus().equals(Status.Staging));
                InputStream is = TransferClientHelper.getData(tclient.getDataTransferDescriptor(),creds);
                int bytesRead = 0;
                int mbRead = 0;
                while(is.read()!=-1){
                    bytesRead++;
                    if(bytesRead%1024==0){
                        System.out.print("." + ++mbRead);
                    }
                }
                System.out.println("READ: " + bytesRead);
          
            } else {
                usage();
                System.exit(1);
            }
        } else {
            usage();
            System.exit(1);
        }
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:60,代码来源:StreamingTransferSystemTestClient.java


示例20: DelegationUserClient

import gov.nih.nci.cagrid.common.security.ProxyUtil; //导入依赖的package包/类
public DelegationUserClient(String url) throws Exception {
	this(url, ProxyUtil.getDefaultProxy());
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:4,代码来源:DelegationUserClient.java



注:本文中的gov.nih.nci.cagrid.common.security.ProxyUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MatchStep类代码示例发布时间:2022-05-16
下一篇:
Java ImmutableSparseVector类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap