本文整理汇总了Java中java.security.SecurityPermission.getName方法的典型用法代码示例。如果您正苦于以下问题:Java SecurityPermission.getName方法的具体用法?Java SecurityPermission.getName怎么用?Java SecurityPermission.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.SecurityPermission
的用法示例。
在下文中一共展示了SecurityPermission.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSecurityPermission
import java.security.SecurityPermission; //导入方法依赖的package包/类
protected boolean checkSecurityPermission(SecurityPermission perm) {
String name = perm.getName();
if (name.equals("getDomainCombiner") || name.equals("getPolicy")
|| name.equals("printIdentity") || name.equals("getSignerPrivateKey")
|| name.startsWith("getProperty.")) {
return true;
}
/*
* this seems needed when analyzing classpath, but not fully sure of its consequences
*/
if (name.startsWith("putProviderProperty.")) {
return true;
}
/*
* createAccessControlContext setPolicy createPolicy.{policy type} setProperty.{key} insertProvider.{provider name} removeProvider.{provider
* name} setSystemScope setIdentityPublicKey setIdentityInfo addIdentityCertificate removeIdentityCertificate
* clearProviderProperties.{provider name} putProviderProperty.{provider name} removeProviderProperty.{provider name} setSignerKeyPair
*/
return false;
}
示例2: test_checkGuardLjava_lang_Object
import java.security.SecurityPermission; //导入方法依赖的package包/类
/**
* @tests java.security.Permission#checkGuard(java.lang.Object)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
method = "checkGuard",
args = {java.lang.Object.class}
)
public void test_checkGuardLjava_lang_Object() {
// test method java.security.permission.checkGuard(object)
SecurityPermission permi = new SecurityPermission(
"Testing the permission abstract class");
String name = permi.getName();
try {
permi.checkGuard(name);
} catch (SecurityException e) {
fail("security not granted when it is suppose to be : " + e);
}
}
示例3: test_getName
import java.security.SecurityPermission; //导入方法依赖的package包/类
/**
* @tests java.security.Permission#getName()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getName",
args = {}
)
public void test_getName() {
// test method java.security.permission.getName()
SecurityPermission permi = new SecurityPermission("testing getName()");
String name = permi.getName();
assertEquals("getName failed to obtain the correct name",
"testing getName()", name);
SecurityPermission permi2 = new SecurityPermission("93048Helloworld");
assertEquals("getName failed to obtain correct name",
"93048Helloworld", permi2.getName());
}
示例4: test_ConstructorLjava_lang_String
import java.security.SecurityPermission; //导入方法依赖的package包/类
/**
* @tests java.security.Permission#Permission(java.lang.String)
*/
public void test_ConstructorLjava_lang_String() {
// test method java.security.permission.Permission(string)
SecurityPermission permi = new SecurityPermission(
"Testing the permission abstract class");
String name = permi.getName();
assertEquals("Permission Constructor failed",
"Testing the permission abstract class", name);
}
示例5: test_checkGuardLjava_lang_Object
import java.security.SecurityPermission; //导入方法依赖的package包/类
/**
* @tests java.security.Permission#checkGuard(java.lang.Object)
*/
public void test_checkGuardLjava_lang_Object() {
// test method java.security.permission.checkGuard(object)
SecurityPermission permi = new SecurityPermission(
"Testing the permission abstract class");
String name = permi.getName();
try {
permi.checkGuard(name);
} catch (SecurityException e) {
fail("security not granted when it is suppose to be : " + e);
}
}
示例6: test_getName
import java.security.SecurityPermission; //导入方法依赖的package包/类
/**
* @tests java.security.Permission#getName()
*/
public void test_getName() {
// test method java.security.permission.getName()
SecurityPermission permi = new SecurityPermission("testing getName()");
String name = permi.getName();
assertEquals("getName failed to obtain the correct name",
"testing getName()", name);
SecurityPermission permi2 = new SecurityPermission("93048Helloworld");
assertEquals("getName failed to obtain correct name",
"93048Helloworld", permi2.getName());
}