本文整理匯總了Java中org.onosproject.security.SecurityAdminService類的典型用法代碼示例。如果您正苦於以下問題:Java SecurityAdminService類的具體用法?Java SecurityAdminService怎麽用?Java SecurityAdminService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SecurityAdminService類屬於org.onosproject.security包,在下文中一共展示了SecurityAdminService類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.onosproject.security.SecurityAdminService; //導入依賴的package包/類
@Override
protected void execute() {
ApplicationAdminService applicationAdminService = get(ApplicationAdminService.class);
ApplicationId appId = applicationAdminService.getId(name);
if (appId == null) {
print("No such application: %s", name);
return;
}
Application app = applicationAdminService.getApplication(appId);
SecurityAdminService smService = SecurityUtil.getSecurityService();
if (smService == null) {
print("Security Mode is disabled");
return;
}
if (accept == null) {
smService.review(appId);
printPolicy(smService, app);
} else if (accept.trim().equals("accept")) {
smService.acceptPolicy(appId);
printPolicy(smService, app);
} else {
print("Unknown command");
}
}
示例2: printPolicy
import org.onosproject.security.SecurityAdminService; //導入依賴的package包/類
private void printPolicy(SecurityAdminService smService, Application app) {
print("\n*******************************");
print(" SM-ONOS APP REVIEW ");
print("*******************************");
print("Application name: %s ", app.id().name());
print("Application role: " + app.role());
print("\nDeveloper specified permissions: ");
printMap(smService.getPrintableSpecifiedPermissions(app.id()));
print("\nPermissions granted: ");
printMap(smService.getPrintableGrantedPermissions(app.id()));
print("\nAdditional permissions requested on runtime (POLICY VIOLATIONS): ");
printMap(smService.getPrintableRequestedPermissions(app.id()));
print("");
}
示例3: execute
import org.onosproject.security.SecurityAdminService; //導入依賴的package包/類
@Override
protected void execute() {
ApplicationAdminService applicationAdminService = get(ApplicationAdminService.class);
ApplicationId appId = applicationAdminService.getId(name);
if (appId == null) {
print("No such application: %s", name);
return;
}
Application app = applicationAdminService.getApplication(appId);
SecurityAdminService smService = SecurityUtil.getSecurityService();
if (smService == null) {
print("Security Mode is disabled");
return;
}
if (accept == null) {
smService.review(appId);
printPolicy(smService, app);
} else if ("accept".equals(accept.trim())) {
smService.acceptPolicy(appId);
printPolicy(smService, app);
} else {
print("Unknown command");
}
}
示例4: testConvertToJavaPermissions
import org.onosproject.security.SecurityAdminService; //導入依賴的package包/類
@Test
public void testConvertToJavaPermissions() {
List<Permission> result = Lists.newArrayList();
for (org.onosproject.security.Permission perm : testPermissions) {
Permission javaPerm = new AppPermission(perm.getName());
if (javaPerm != null) {
if (javaPerm instanceof AppPermission) {
if (((AppPermission) javaPerm).getType() != null) {
AppPermission ap = (AppPermission) javaPerm;
result.add(ap);
}
} else if (javaPerm instanceof ServicePermission) {
if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
result.add(javaPerm);
}
} else {
result.add(javaPerm);
}
}
}
assertTrue(!result.isEmpty());
assertEquals("APP_READ", result.get(0).getName());
}
示例5: convertToJavaPermissions
import org.onosproject.security.SecurityAdminService; //導入依賴的package包/類
public static List<Permission> convertToJavaPermissions(Set<org.onosproject.security.Permission> permissions) {
List<Permission> result = Lists.newArrayList();
for (org.onosproject.security.Permission perm : permissions) {
Permission javaPerm = getPermission(perm);
if (javaPerm != null) {
if (javaPerm instanceof AppPermission) {
if (((AppPermission) javaPerm).getType() != null) {
AppPermission ap = (AppPermission) javaPerm;
result.add(ap);
if (serviceDirectory.containsKey(ap.getType())) {
for (String service : serviceDirectory.get(ap.getType())) {
result.add(new ServicePermission(service, ServicePermission.GET));
}
}
}
} else if (javaPerm instanceof ServicePermission) {
if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
result.add(javaPerm);
}
} else {
result.add(javaPerm);
}
}
}
return result;
}