本文整理汇总了Java中javax.security.auth.PrivateCredentialPermission类的典型用法代码示例。如果您正苦于以下问题:Java PrivateCredentialPermission类的具体用法?Java PrivateCredentialPermission怎么用?Java PrivateCredentialPermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrivateCredentialPermission类属于javax.security.auth包,在下文中一共展示了PrivateCredentialPermission类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: test_getPrincipals
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#getPrincipals()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getPrincipals",
args = {}
)
public void test_getPrincipals() {
PrivateCredentialPermission ap = new PrivateCredentialPermission(name3, "read");
String[][] p = ap.getPrincipals();
assertEquals("wrong number of principals", 2, p.length);
assertEquals("wrong principal class 0", pc1, p[0][0]);
assertEquals("wrong principal name 0", pn1, p[0][1]);
assertEquals("wrong principal class 1", pc2, p[1][0]);
assertEquals("wrong principal name 1", pn2, p[1][1]);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:PrivateCredentialPermissionTest.java
示例2: checkPermission
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
@Override
public void checkPermission(Permission perm) {
if (perm instanceof PrivateCredentialPermission) {
if (!perm.getName().startsWith("javax.security.auth.kerberos.")) {
throw new AccessControlException(
"I don't like this", perm);
}
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:KeyPermissions.java
示例3: test_getActions
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#getActions()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getActions",
args = {}
)
public void test_getActions() {
PrivateCredentialPermission ap = new PrivateCredentialPermission(name1, "read");
assertEquals("getActions() must alway return \"read\"", "read", ap.getActions());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:14,代码来源:PrivateCredentialPermissionTest.java
示例4: test_implies
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#implies()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "implies",
args = { Permission.class }
)
public void test_implies() {
PrivateCredentialPermission p1 = new PrivateCredentialPermission("* P1 \"abc\"", "read");
PrivateCredentialPermission p2 = new PrivateCredentialPermission("a.b.Credential P1 \"abc\"", "read");
PrivateCredentialPermission p3 = new PrivateCredentialPermission("C1 P1 \"abc\"", "read");
PrivateCredentialPermission p4 = new PrivateCredentialPermission("C1 P1 \"abc\" P2 \"abcd\"", "read");
PrivateCredentialPermission p5 = new PrivateCredentialPermission("C1 P1 \"*\"", "read");
PrivateCredentialPermission p6 = new PrivateCredentialPermission("a.b.Credential * \"*\"", "read");
PrivateCredentialPermission p7 = new PrivateCredentialPermission("a.b.Credential P2 \"abc\"", "read");
PrivateCredentialPermission p8 = new PrivateCredentialPermission("a.b.Credential1 P2 \"abc\"", "read");
PrivateCredentialPermission p9 = new PrivateCredentialPermission("a.b.Credential1 P2 \"*\"", "read");
PrivateCredentialPermission[][] arr = { { p1, p2 },
{ p2, p1 },
{ p3, p4 },
{ p5, p3 },
{ p6, p2 },
{ p2, p7 },
{ p7, p8 },
{ p8, p9 }};
boolean[] r = { true, false, true, true, true, false, false, false };
for(int i = 0; i < arr.length; i++)
assertEquals("implies() returned wrong result (" + i + ")", r[i], arr[i][0].implies(arr[i][1]));
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:PrivateCredentialPermissionTest.java
示例5: test_getCredentialClass
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#getCredentialClass()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getCredentialClass",
args = {}
)
public void test_getCredentialClass() {
PrivateCredentialPermission ap = new PrivateCredentialPermission(name1, "read");
assertEquals("getCredentialClass() returned wrong name", cred_class1, ap.getCredentialClass());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:14,代码来源:PrivateCredentialPermissionTest.java
示例6: test_equals
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#equals()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "equals",
args = { Object.class }
)
public void test_equals() {
PrivateCredentialPermission p1 = new PrivateCredentialPermission(name3, "read");
PrivateCredentialPermission p2 = new PrivateCredentialPermission(name3, "read");
PrivateCredentialPermission p3 = new PrivateCredentialPermission(name1, "read");
PrivateCredentialPermission p4 = new PrivateCredentialPermission(name1, "read");
PrivateCredentialPermission p5 = new PrivateCredentialPermission(name2, "read");
PrivateCredentialPermission p6 = new PrivateCredentialPermission(name4, "read");
PrivateCredentialPermission arr[][] = { { p1, p2 },
{ p3, p4 },
{ p4, p5 },
{ p1, p3 },
{ p4, p6 } };
boolean r[] = { true, true, false, false, false };
for(int i = 0; i < arr.length; i++) {
assertEquals("equals() returned wrong result", r[i], arr[i][0].equals(arr[i][1]));
}
try {
assertFalse(p1.equals(null));
} catch(NullPointerException npe) {
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:PrivateCredentialPermissionTest.java
示例7: test_hashCode
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#hashCode()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "hashCode",
args = {}
)
public void test_hashCode() {
PrivateCredentialPermission p1 = new PrivateCredentialPermission(name1, "read");
PrivateCredentialPermission p2 = new PrivateCredentialPermission(name1, "read");
int arr[][] = new int[10][];
for(int i = 0; i < 10; i++) {
int h1 = p1.hashCode();
System.gc();
// force some memory allocations
arr[i] = new int[50000];
assertEquals("hashCode() must consistently return the same integer", h1, p1.hashCode());
assertEquals("hashCode() must be the same for equal PrivateCredentialPermission objects", p1.hashCode(), p2.hashCode());
}
PrivateCredentialPermission p3 = new PrivateCredentialPermission(name4, "read");
assertFalse("hashCode() must not be the same for non-equal PrivateCredentialPermission objects", p1.hashCode() == p3.hashCode());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:30,代码来源:PrivateCredentialPermissionTest.java
示例8: test_newPermissionCollection
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
/**
* @tests javax.security.auth.PrivateCredentialPermission#newPermissionCollection()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "newPermissionCollection",
args = {}
)
public void test_newPermissionCollection() {
PrivateCredentialPermission ap = new PrivateCredentialPermission(name1, "read");
assertNull("newPermissionCollection must always return null", ap.newPermissionCollection());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:14,代码来源:PrivateCredentialPermissionTest.java
示例9: getOnosPermission
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
public static org.onosproject.security.Permission getOnosPermission(Permission permission) {
if (permission instanceof AppPermission) {
return new org.onosproject.security.Permission(AppPermission.class.getName(), permission.getName(), "");
} else if (permission instanceof FilePermission) {
return new org.onosproject.security.Permission(
FilePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof SerializablePermission) {
return new org.onosproject.security.Permission(
SerializablePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof NetPermission) {
return new org.onosproject.security.Permission(
NetPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof RuntimePermission) {
return new org.onosproject.security.Permission(
RuntimePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof SocketPermission) {
return new org.onosproject.security.Permission(
SocketPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof SQLPermission) {
return new org.onosproject.security.Permission(
SQLPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof PropertyPermission) {
return new org.onosproject.security.Permission(
PropertyPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof LoggingPermission) {
return new org.onosproject.security.Permission(
LoggingPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof SSLPermission) {
return new org.onosproject.security.Permission(
SSLPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof AuthPermission) {
return new org.onosproject.security.Permission(
AuthPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof PrivateCredentialPermission) {
return new org.onosproject.security.Permission(
PrivateCredentialPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof DelegationPermission) {
return new org.onosproject.security.Permission(
DelegationPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof javax.security.auth.kerberos.ServicePermission) {
return new org.onosproject.security.Permission(
javax.security.auth.kerberos.ServicePermission.class.getName(), permission.getName(),
permission.getActions());
} else if (permission instanceof AudioPermission) {
return new org.onosproject.security.Permission(
AudioPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof AdaptPermission) {
return new org.onosproject.security.Permission(
AdaptPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof BundlePermission) {
return new org.onosproject.security.Permission(
BundlePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof CapabilityPermission) {
return new org.onosproject.security.Permission(
CapabilityPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof PackagePermission) {
return new org.onosproject.security.Permission(
PackagePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof ServicePermission) {
return new org.onosproject.security.Permission(
ServicePermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof AdminPermission) {
return new org.onosproject.security.Permission(
AdminPermission.class.getName(), permission.getName(), permission.getActions());
} else if (permission instanceof ConfigurationPermission) {
return new org.onosproject.security.Permission(
ConfigurationPermission.class.getName(), permission.getName(), permission.getActions());
}
return null;
}
开发者ID:shlee89,项目名称:athena,代码行数:71,代码来源:DefaultPolicyBuilder.java
示例10: getPermission
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
private static Permission getPermission(org.onosproject.security.Permission permission) {
String classname = permission.getClassName();
String name = permission.getName();
String actions = permission.getActions();
if (classname == null || name == null) {
return null;
}
classname = classname.trim();
name = name.trim();
actions = actions.trim();
if (AppPermission.class.getName().equals(classname)) {
return new AppPermission(name);
} else if (FilePermission.class.getName().equals(classname)) {
return new FilePermission(name, actions);
} else if (SerializablePermission.class.getName().equals(classname)) {
return new SerializablePermission(name, actions);
} else if (NetPermission.class.getName().equals(classname)) {
return new NetPermission(name, actions);
} else if (RuntimePermission.class.getName().equals(classname)) {
return new RuntimePermission(name, actions);
} else if (SocketPermission.class.getName().equals(classname)) {
return new SocketPermission(name, actions);
} else if (SQLPermission.class.getName().equals(classname)) {
return new SQLPermission(name, actions);
} else if (PropertyPermission.class.getName().equals(classname)) {
return new PropertyPermission(name, actions);
} else if (LoggingPermission.class.getName().equals(classname)) {
return new LoggingPermission(name, actions);
} else if (SSLPermission.class.getName().equals(classname)) {
return new SSLPermission(name, actions);
} else if (AuthPermission.class.getName().equals(classname)) {
return new AuthPermission(name, actions);
} else if (PrivateCredentialPermission.class.getName().equals(classname)) {
return new PrivateCredentialPermission(name, actions);
} else if (DelegationPermission.class.getName().equals(classname)) {
return new DelegationPermission(name, actions);
} else if (javax.security.auth.kerberos.ServicePermission.class.getName().equals(classname)) {
return new javax.security.auth.kerberos.ServicePermission(name, actions);
} else if (AudioPermission.class.getName().equals(classname)) {
return new AudioPermission(name, actions);
} else if (AdaptPermission.class.getName().equals(classname)) {
return new AdaptPermission(name, actions);
} else if (BundlePermission.class.getName().equals(classname)) {
return new BundlePermission(name, actions);
} else if (CapabilityPermission.class.getName().equals(classname)) {
return new CapabilityPermission(name, actions);
} else if (PackagePermission.class.getName().equals(classname)) {
return new PackagePermission(name, actions);
} else if (ServicePermission.class.getName().equals(classname)) {
return new ServicePermission(name, actions);
} else if (AdminPermission.class.getName().equals(classname)) {
return new AdminPermission(name, actions);
} else if (ConfigurationPermission.class.getName().equals(classname)) {
return new ConfigurationPermission(name, actions);
} else if (ReflectPermission.class.getName().equals(classname)) {
return new ReflectPermission(name, actions);
}
//AllPermission, SecurityPermission, UnresolvedPermission
//AWTPermission, ReflectPermission not allowed
return null;
}
开发者ID:shlee89,项目名称:athena,代码行数:67,代码来源:DefaultPolicyBuilder.java
示例11: checkPrivateCredentialPermission
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
protected boolean checkPrivateCredentialPermission(PrivateCredentialPermission perm) {
/*
* it is only used to "read"
*/
return true;
}
开发者ID:EvoSuite,项目名称:evosuite,代码行数:7,代码来源:MSecurityManager.java
示例12: getData
import javax.security.auth.PrivateCredentialPermission; //导入依赖的package包/类
@Override
protected Object[] getData() {
return new Object[] {new PrivateCredentialPermission("a.b.Cred a.c.Princ \"duke\"", "read")};
}
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:PrivateCredentialPermissionTest.java
注:本文中的javax.security.auth.PrivateCredentialPermission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论