本文整理汇总了Java中org.globus.gsi.gssapi.GlobusGSSCredentialImpl类的典型用法代码示例。如果您正苦于以下问题:Java GlobusGSSCredentialImpl类的具体用法?Java GlobusGSSCredentialImpl怎么用?Java GlobusGSSCredentialImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlobusGSSCredentialImpl类属于org.globus.gsi.gssapi包,在下文中一共展示了GlobusGSSCredentialImpl类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testImportExportOpaque
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void testImportExportOpaque() throws Exception {
GlobusGSSCredentialImpl cred =
(GlobusGSSCredentialImpl)manager.createCredential(GSSCredential.ACCEPT_ONLY);
assertTrue(cred != null);
byte [] data = cred.export(ExtendedGSSCredential.IMPEXP_OPAQUE);
assertTrue(data != null);
System.out.println(new String(data));
GlobusGSSCredentialImpl cred2 =
(GlobusGSSCredentialImpl)manager.createCredential(data,
ExtendedGSSCredential.IMPEXP_OPAQUE,
GSSCredential.DEFAULT_LIFETIME,
null,
GSSCredential.ACCEPT_ONLY);
assertTrue(cred2 != null);
assertEquals(cred.getPrivateKey(), cred2.getPrivateKey());
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:21,代码来源:GlobusGSSCredentialTest.java
示例2: testImportExportMechSpecific
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void testImportExportMechSpecific() throws Exception {
GlobusGSSCredentialImpl cred =
(GlobusGSSCredentialImpl)manager.createCredential(GSSCredential.ACCEPT_ONLY);
assertTrue(cred != null);
byte [] data = cred.export(ExtendedGSSCredential.IMPEXP_MECH_SPECIFIC);
assertTrue(data != null);
String handle = new String(data);
System.out.println(handle);
GlobusGSSCredentialImpl cred2 =
(GlobusGSSCredentialImpl)manager.createCredential(data,
ExtendedGSSCredential.IMPEXP_MECH_SPECIFIC,
GSSCredential.DEFAULT_LIFETIME,
null,
GSSCredential.ACCEPT_ONLY);
assertTrue(cred2 != null);
assertEquals(cred.getPrivateKey(), cred2.getPrivateKey());
handle = handle.substring(handle.indexOf('=')+1);
assertTrue((new File(handle)).delete());
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:26,代码来源:GlobusGSSCredentialTest.java
示例3: testPutGet2
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void testPutGet2() throws Exception {
myProxy.put(cred,
username,
password,
lifetime);
GSSCredential mCred = myProxy.get(cred,
username,
password,
lifetime);
assertTrue(mCred != null);
GlobusCredential gCred =
((GlobusGSSCredentialImpl)mCred).getGlobusCredential();
assertTrue(gCred != null);
gCred.verify();
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:MyProxyTest.java
示例4: testStore
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void testStore() throws Exception {
String credName = "foobar";
String credDesc = "foobar description";
StoreParams storeRequest = new StoreParams();
storeRequest.setUserName(username);
storeRequest.setCredentialName(credName);
storeRequest.setCredentialDescription(credDesc);
GlobusCredential globusCred =
((GlobusGSSCredentialImpl)cred).getGlobusCredential();
myProxy.store(cred,
globusCred.getCertificateChain(),
new BouncyCastleOpenSSLKey(globusCred.getPrivateKey()),
storeRequest);
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:MyProxyTest.java
示例5: getData
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
/**
* Returns a handle to the input stream of the socket which is returning the
* data referred to by the descriptor. This method can make an https
* connection if desired using the credentials passed in. If you wish to use
* this method to connect to http it will not use the Crediential whether
* you pass them in or they are null,
*
* @param desc
* data transfer descriptor received from
* TransferServiceContextClient
* @param creds
* creator of the transfer resource credentials
* @return
* @throws Exception
*/
public static InputStream getData(DataTransferDescriptor desc, GlobusCredential creds) throws Exception {
InputStream dataStream = null;
URL url = new URL(desc.getUrl());
if (url.getProtocol().equals("http")) {
URLConnection conn = url.openConnection();
conn.connect();
dataStream = conn.getInputStream();
} else if (url.getProtocol().equals("https")) {
if (creds != null) {
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(creds, GSSCredential.INITIATE_AND_ACCEPT);
GSIHttpURLConnection connection = new GSIHttpURLConnection(url);
connection.setGSSMode(GSIConstants.MODE_SSL);
connection.setCredentials(cred);
dataStream = connection.getInputStream();
} else {
throw new Exception(
"To use the https protocol to retrieve data from the Transfer Service you must have credentials");
}
} else {
throw new Exception("Protocol " + url.getProtocol() + " not supported.");
}
return dataStream;
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:39,代码来源:TransferClientHelper.java
示例6: initializeCredentials
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public static GSSCredential initializeCredentials(boolean personal, String hostcert,
String hostkey) throws GlobusCredentialException, GSSException {
if (!personal) {
return new GlobusGSSCredentialImpl(new GlobusCredential(hostcert != null ? hostcert
: "/etc/grid-security/hostcert.pem", hostkey != null ? hostkey
: "/etc/grid-security/hostkey.pem"), GSSCredential.INITIATE_AND_ACCEPT);
}
else {
return new GlobusGSSCredentialImpl(GlobusCredential.getDefaultCredential(),
GSSCredential.INITIATE_AND_ACCEPT);
}
}
开发者ID:swift-lang,项目名称:swift-k,代码行数:13,代码来源:GSSService.java
示例7: loadProxyFromFile
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
private static GSSCredential loadProxyFromFile(String proxyPath) {
try {
GlobusCredential cred = new GlobusCredential(proxyPath);
return new GlobusGSSCredentialImpl(cred, GSSCredential.INITIATE_AND_ACCEPT);
}
catch (Exception e) {
throw new SecurityException(e);
}
}
开发者ID:swift-lang,项目名称:swift-k,代码行数:10,代码来源:GlobusSecurityContextImpl.java
示例8: load
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
private static GSSCredential load(String file) {
try {
GlobusCredential cred = new GlobusCredential(file);
return new GlobusGSSCredentialImpl(cred, GSSCredential.INITIATE_AND_ACCEPT);
} catch(Exception e) {
System.err.println("Failed to load proxy: " + e.getMessage());
System.exit(-1);
}
return null;
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:11,代码来源:MultiUserGramTest.java
示例9: testPutGet3
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void testPutGet3() throws Exception {
myProxy.put(cred,
username,
password,
lifetime);
GSSCredential mCred = myProxy.get(username,
password,
lifetime);
assertTrue(mCred != null);
GlobusCredential gCred =
((GlobusGSSCredentialImpl)mCred).getGlobusCredential();
assertTrue(gCred != null);
gCred.verify();
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:16,代码来源:MyProxyTest.java
示例10: createGSSCredential
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public static GSSCredential createGSSCredential(GridProxy proxy) throws Exception
{
VGridCredential sourceCred = proxy.getCredential();
if (sourceCred instanceof GlobusCredentialWrapper)
{
GlobusGSSCredentialImpl gssCred = createGSSCredential(((GlobusCredentialWrapper) sourceCred).getGlobusCredential());
return gssCred;
}
else
{
throw new Exception("Cannot convert non GlobusCredentials to GSS Credentials:" + sourceCred.getClass());
}
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:15,代码来源:GlobusUtil.java
示例11: convertCredential
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
@Override
public VGridCredential convertCredential(VGridCredential sourceCred, String type) throws Exception
{
if (sourceCred instanceof GlobusCredentialWrapper)
{
if (StringUtil.equals(GridProxy.GSS_CREDENTIAL_TYPE,type))
{
GlobusGSSCredentialImpl gssCred = createGSSCredential( ((GlobusCredentialWrapper)sourceCred).getGlobusCredential());
return new GSSCredentialWrapper(this,gssCred);
}
}
return null;
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:15,代码来源:GlobusCredentialProvider.java
示例12: getValidGSSCredential
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
private static GSSCredential getValidGSSCredential(
VRSContext context) throws GlobusCredentialException,
GSSException, AuthenticationException
{
// debug("getGlobusCredentials");
GridProxy proxy = context.getGridProxy();
if (proxy == null)
{
throw new nl.esciencecenter.vlet.exception.AuthenticationException(
"NULL grid credential (Not set for this context)");
}
if (proxy.isValid() == false)
{
throw new nl.esciencecenter.vlet.exception.AuthenticationException(
"No valid grid credential found");
}
GlobusCredential globusCred = GlobusUtil.getGlobusCredential(proxy);
if (globusCred != null)
{
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(
globusCred, GSSCredential.DEFAULT_LIFETIME);
return cred;
}
throw new AuthenticationException(
"Couldn't find proper GSI credentials (no proxy?)");
// return null;
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:35,代码来源:GftpFileSystem.java
示例13: putData
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
/**
* Reads from the input stream to put the data to the server. Be sure to
* close the stream when done writing the data. This method can use http and
* https if the credentials are provided. This is a blocking call. Will
* return with the entire data has been transmitted.
*
* @param is
* input stream providing the data
* @param contentLength
* number of bytes in the input stream to be read
* @param desc
* data transfer descriptor received from
* TransferServiceContextClient
* @param creds
* creator of the transfer resource credentials
* @return
* @throws Exception
*/
public static void putData(InputStream is, long contentLength, DataTransferDescriptor desc, GlobusCredential creds)
throws Exception {
URL url = new URL(desc.getUrl());
if (url.getProtocol().equals("http")) {
PostMethod post = new PostMethod(desc.getUrl());
InputStreamRequestEntity re = new InputStreamRequestEntity(is, contentLength);
post.setRequestEntity(re);
HttpClient client = new HttpClient();
int status = client.executeMethod(post);
} else if (url.getProtocol().equals("https")) {
if (creds != null) {
GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(creds, GSSCredential.INITIATE_AND_ACCEPT);
GSIHttpURLConnection connection = new GSIHttpURLConnection(url);
connection.setGSSMode(GSIConstants.MODE_SSL);
connection.setCredentials(cred);
try {
int l = -1;
byte[] buffer = new byte[1024];
while ((l = is.read(buffer)) != -1) {
connection.getOutputStream().write(buffer, 0, l);
}
} finally {
is.close();
}
connection.getOutputStream().close();
connection.getInputStream().close();
} else {
throw new Exception(
"To use the https protocol to stage data to the Transfer Service you must have credentials");
}
} else {
throw new Exception("Protocol " + url.getProtocol() + " not supported.");
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:53,代码来源:TransferClientHelper.java
示例14: configure
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void configure(Stub stub) throws CommunicationStyleException{
try{
stub._setProperty(Constants.GSI_SEC_CONV, GSIConstants.ENCRYPTION);
if (credential != null) {
GSSCredential gss = new GlobusGSSCredentialImpl(credential, GSSCredential.INITIATE_AND_ACCEPT);
stub._setProperty(org.globus.axis.gsi.GSIConstants.GSI_CREDENTIALS, gss);
}
}catch(Exception e){
e.printStackTrace();
throw new CommunicationStyleException(e.getMessage());
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:13,代码来源:SecureConversationWithEncryption.java
示例15: configure
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void configure(Stub stub) throws CommunicationStyleException{
try{
Util.registerTransport();
stub._setProperty(GSIConstants.GSI_TRANSPORT, GSIConstants.ENCRYPTION);
if (credential != null) {
GSSCredential gss = new GlobusGSSCredentialImpl(credential, GSSCredential.INITIATE_AND_ACCEPT);
stub._setProperty(org.globus.axis.gsi.GSIConstants.GSI_CREDENTIALS, gss);
}
}catch(Exception e){
e.printStackTrace();
throw new CommunicationStyleException(e.getMessage());
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:14,代码来源:SecureTransportWithEncryption.java
示例16: generateGSSCredential
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public static GSSCredential generateGSSCredential(String serverKey, String serverCert) throws GlobusCredentialException, CredentialException, IOException, GSSException {
X509Credential credentials;
// first try to read the service cert and key from the jvm properties
if (serverKey == null && serverCert == null) {
// read it from jvm properties
serverKey = System.getProperty("X509_SERVICE_KEY");
serverCert = System.getProperty("X509_SERVICE_CERT");
}
// if not, try to read the service cert and key from the environment
if (serverKey == null && serverCert == null) {
// read it from env
serverKey = System.getenv("X509_HOST_KEY");
serverCert = System.getenv("X509_HOST_CERT");
}
// if not, try to read the default location /etc/grid-security/host{cert,key}.pem
if (serverKey == null && serverCert == null) {
// read it from env
serverKey = "/etc/grid-security/hostkey.pem";
serverCert = "/etc/grid-security/hostcert.pem";
File certFile = new File(serverCert);
File keyFile = new File(serverKey);
// last, try to use user proxy, if it exists (currently disabled, look above)
if (!certFile.exists()) {
serverCert = null;
}
if (!keyFile.exists()) {
serverKey = null;
}
}
if (serverKey == null && serverCert == null) {
// no X509_HOST_* var, use client cert (proxy-cert)
credentials = X509Credential.getDefaultCredential();
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Using user proxy certificate:" + credentials.getSubject());
}
} else if (serverKey != null && serverCert != null) {
credentials = new X509Credential(serverCert, serverKey);
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, "Using host certificate:" + credentials.getSubject());
}
} else {
throw new IOException("Error: Service credentials could not be loaded.");
}
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "credentials:" + credentials);
}
return new GlobusGSSCredentialImpl(credentials, GSSCredential.ACCEPT_ONLY);
}
开发者ID:fast-data-transfer,项目名称:fdt,代码行数:54,代码来源:GSIServer.java
示例17: connect
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public void connect(String host,int port) throws Exception
{
if (port<=0)
port=5010;
this.socket = new Socket(host,port);
CertUtil.init();
GlobusCredential cred;
cred = GlobusCredential.getDefaultCredential();
this.input = new DataInputStream(new BufferedInputStream(
this.socket.getInputStream()));
this.output = new DataOutputStream(new BufferedOutputStream(
this.socket.getOutputStream()));
GSSCredential gssCred = new GlobusGSSCredentialImpl(cred,
GSSCredential.INITIATE_AND_ACCEPT);
new GSSTokenSend(nullToken).send(this.output);
GSSTokenRecv returnToken = new GSSTokenRecv();
returnToken.readFrom(this.input);
GSSManager manager = new GlobusGSSManagerImpl();
ExtendedGSSContext context = (ExtendedGSSContext) manager.createContext(
null,
GSSConstants.MECH_OID,
gssCred,
86400);
context.requestMutualAuth(true); // true
context.requestCredDeleg(false);
context.requestConf(false); // true
context.requestAnonymity(false);
context.setOption(
GSSConstants.GSS_MODE,
GSIConstants.MODE_GSI);
context.setOption(
GSSConstants.REJECT_LIMITED_PROXY,
Boolean.FALSE);
byte[] inToken = new byte[0];
// Loop while there still is a token to be processed
while (!context.isEstablished())
{
byte[] outToken = context.initSecContext(inToken, 0,
inToken.length);
// send the output token if generated
if (outToken != null)
{
new GSSTokenSend(CSEC_TOKEN_MAGIC_1, 3,
outToken).send(this.output);
// gssTokenSend(this.output, );
this.output.flush();
}
if (!context.isEstablished())
{
GSSTokenRecv gsstoken = new GSSTokenRecv();
gsstoken.readFrom(this.input);
inToken = gsstoken.getToken();
}
}
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:69,代码来源:TestBOL0.java
示例18: GSSCredentialWrapper
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public GSSCredentialWrapper(GlobusCredentialProvider provider, GlobusGSSCredentialImpl gssCred)
{
this.credential=gssCred;
this.provider=provider;
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:6,代码来源:GSSCredentialWrapper.java
示例19: getInvocationCredential
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; //导入依赖的package包/类
public static GlobusCredential getInvocationCredential() {
org.apache.axis.MessageContext ctx = org.apache.axis.MessageContext.getCurrentContext();
Subject subject = (Subject) ctx.getProperty(Constants.INVOCATION_SUBJECT);
GlobusGSSCredentialImpl credential = (GlobusGSSCredentialImpl) JaasGssUtil.getCredential(subject);
return credential.getGlobusCredential();
}
开发者ID:NCIP,项目名称:caarray,代码行数:7,代码来源:CaArraySvcAuthorization.java
注:本文中的org.globus.gsi.gssapi.GlobusGSSCredentialImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论