当前位置: 首页>>代码示例>>Java>>正文


Java SecurityPermission.getName方法代码示例

本文整理汇总了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;
	}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:25,代码来源:MSecurityManager.java

示例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);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:Permission2Test.java

示例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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:Permission2Test.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:Permission2Test.java

示例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);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:Permission2Test.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:Permission2Test.java


注:本文中的java.security.SecurityPermission.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。