本文整理汇总了Java中gov.nih.nci.cagrid.common.security.ProxyUtil类的典型用法代码示例。如果您正苦于以下问题:Java ProxyUtil类的具体用法?Java ProxyUtil怎么用?Java ProxyUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProxyUtil类属于gov.nih.nci.cagrid.common.security包,在下文中一共展示了ProxyUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
}
示例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;
}
示例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.");
}
}
示例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;
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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"));
}
示例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);
}
示例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;
}
}
示例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);
}