本文整理汇总了Java中ca.nrc.cadc.auth.SSLUtil.createSubject方法的典型用法代码示例。如果您正苦于以下问题:Java SSLUtil.createSubject方法的具体用法?Java SSLUtil.createSubject怎么用?Java SSLUtil.createSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.nrc.cadc.auth.SSLUtil
的用法示例。
在下文中一共展示了SSLUtil.createSubject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CaomRepoBaseIntTests
import ca.nrc.cadc.auth.SSLUtil; //导入方法依赖的package包/类
/**
* @param resourceID resource identifier of service to test
* @param pem1 PEM file for user with read-write permission
* @param pem2 PEM file for user with read-only permission
* @param pem3 PEM file for user with no permissions
*/
public CaomRepoBaseIntTests(URI resourceID, URI repoStandardID, String pem1, String pem2, String pem3) {
try {
if (pem1 != null) {
File sslCert1 = FileUtil.getFileFromResource(pem1, this.getClass());
subject1 = SSLUtil.createSubject(sslCert1);
}
if (pem2 != null) {
File sslCert2 = FileUtil.getFileFromResource(pem2, this.getClass());
subject2 = SSLUtil.createSubject(sslCert2);
}
if (pem3 != null) {
File sslCert3 = FileUtil.getFileFromResource(pem3, this.getClass());
subject3 = SSLUtil.createSubject(sslCert3);
}
RegistryClient rc = new RegistryClient();
URL serviceURL = rc.getServiceURL(resourceID, repoStandardID, AuthMethod.ANON);
baseHTTPURL = serviceURL.toExternalForm();
serviceURL = rc.getServiceURL(resourceID, repoStandardID, AuthMethod.CERT);
baseHTTPSURL = serviceURL.toExternalForm();
log.debug("test service URL: " + baseHTTPURL);
log.debug("test service URL: " + baseHTTPSURL);
} catch (Throwable t) {
String message = "Failed int-test initialization: " + t.getMessage();
log.fatal(message, t);
throw new ExceptionInInitializerError(message);
}
}
示例2: testSingleVOSUri
import ca.nrc.cadc.auth.SSLUtil; //导入方法依赖的package包/类
@Test
public void testSingleVOSUri()
{
try
{
log.debug("testSingleVOSUri");
final String[] args = new String[]
{
"--collection=TEST",
"--observationID=VOSpaceFile",
"--productID=productID",
"--uri=" + VOS_URI_BLAST_250,
"--default=src/int-test/resources/simplefits.default"
};
Subject subject = SSLUtil.createSubject(SSL_CERT);
Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
{
@Override
public Object run() throws Exception
{
doTest(args);
doTest(args, "build/tmp/SimpleFitsTest.xml");
return null;
}
});
// check that CDi_j worked
ObservationReader or = new ObservationReader();
Observation o = or.read(new FileReader("build/tmp/SimpleFitsTest.xml"));
Assert.assertNotNull(o);
Chunk c = o.getPlanes().iterator().next().getArtifacts().iterator().next().getParts().iterator().next().getChunks().iterator().next();
Assert.assertNotNull("chunk.position", c.position);
Assert.assertNotNull("chunk.position.axis.function", c.position.getAxis().function);
log.info("testSingleVOSUri passed.");
}
catch (Exception unexpected)
{
log.error("unexpected exception", unexpected);
Assert.fail("unexpected exception: " + unexpected);
}
}
示例3: testMultipleVOSUri
import ca.nrc.cadc.auth.SSLUtil; //导入方法依赖的package包/类
@Test
public void testMultipleVOSUri()
{
try
{
log.debug("testMultipleVOSUri");
final String[] args = new String[]
{
"--collection=TEST",
"--observationID=VOSpaceFile",
"--productID=productID",
"--uri=" + VOS_URI_BLAST_250 +"," + VOS_URI_BLAST_350,
"--default=src/int-test/resources/simplefits.default"
};
Subject subject = SSLUtil.createSubject(SSL_CERT);
Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
{
@Override
public Object run() throws Exception
{
doTest(args);
doTest(args, "build/tmp/SimpleFitsTest.xml");
return null;
}
});
// check that CDi_j worked
ObservationReader or = new ObservationReader();
Observation o = or.read(new FileReader("build/tmp/SimpleFitsTest.xml"));
Assert.assertNotNull(o);
Chunk c = o.getPlanes().iterator().next().getArtifacts().iterator().next().getParts().iterator().next().getChunks().iterator().next();
Assert.assertNotNull("chunk.position", c.position);
Assert.assertNotNull("chunk.position.axis.function", c.position.getAxis().function);
log.info("testMultipleVOSUri passed.");
}
catch (Exception unexpected)
{
log.error("unexpected exception", unexpected);
Assert.fail("unexpected exception: " + unexpected);
}
}
示例4: testVOSUriWithLocal
import ca.nrc.cadc.auth.SSLUtil; //导入方法依赖的package包/类
@Test
public void testVOSUriWithLocal()
{
try
{
log.debug("testVOSUriWithLocal");
final String[] args = new String[]
{
"--collection=TEST",
"--observationID=VOSpaceFile",
"--productID=productID",
"--uri=" + VOS_URI_BLAST_250,
"--local=src/int-test/resources/mef.fits",
"--default=src/int-test/resources/multiextensionfits.default"
};
Subject subject = SSLUtil.createSubject(SSL_CERT);
Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
{
@Override
public Object run() throws Exception
{
doTest(args);
doTest(args, "build/tmp/SimpleFitsTest.xml");
return null;
}
});
// check that CDi_j worked
ObservationReader or = new ObservationReader();
Observation o = or.read(new FileReader("build/tmp/SimpleFitsTest.xml"));
Assert.assertNotNull(o);
Chunk c = o.getPlanes().iterator().next().getArtifacts().iterator().next().getParts().iterator().next().getChunks().iterator().next();
Assert.assertNotNull("chunk.position", c.position);
Assert.assertNotNull("chunk.position.axis.function", c.position.getAxis().function);
log.info("testVOSUriWithLocal passed.");
}
catch (Exception unexpected)
{
log.error("unexpected exception", unexpected);
Assert.fail("unexpected exception: " + unexpected);
}
}