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


Java SecurityAdminService类代码示例

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

示例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("");

}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:ReviewCommand.java

示例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");
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:25,代码来源:ReviewCommand.java

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

示例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;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:DefaultPolicyBuilder.java


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