當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。