Example usage for org.apache.shiro.realm.text IniRealm ROLES_SECTION_NAME

List of usage examples for org.apache.shiro.realm.text IniRealm ROLES_SECTION_NAME

Introduction

In this page you can find the example usage for org.apache.shiro.realm.text IniRealm ROLES_SECTION_NAME.

Prototype

String ROLES_SECTION_NAME

To view the source code for org.apache.shiro.realm.text IniRealm ROLES_SECTION_NAME.

Click Source Link

Usage

From source file:ApacheShiro.ShiroMVC.java

public void CrearIni() {
    defaultSecurityManager = new DefaultSecurityManager();
    ini = new Ini();
    usuarios = ini.addSection(IniRealm.USERS_SECTION_NAME);
    roles = ini.addSection(IniRealm.ROLES_SECTION_NAME);

    //        defaultSecurityManager.setRealm(new IniRealm(ini));
    //        SecurityUtils.setSecurityManager(defaultSecurityManager);
}

From source file:org.apache.aurora.scheduler.http.api.security.ApiSecurityIT.java

License:Apache License

@Before
public void setUp() {
    ini = new Ini();

    Ini.Section users = ini.addSection(IniRealm.USERS_SECTION_NAME);
    users.put(ROOT.getUserName(), COMMA_JOINER.join(ROOT.getPassword(), ADMIN_ROLE));
    users.put(WFARNER.getUserName(), COMMA_JOINER.join(WFARNER.getPassword(), ENG_ROLE));
    users.put(UNPRIVILEGED.getUserName(), UNPRIVILEGED.getPassword());
    users.put(BACKUP_SERVICE.getUserName(), COMMA_JOINER.join(BACKUP_SERVICE.getPassword(), BACKUP_ROLE));
    users.put(DEPLOY_SERVICE.getUserName(), COMMA_JOINER.join(DEPLOY_SERVICE.getPassword(), DEPLOY_ROLE));

    Ini.Section roles = ini.addSection(IniRealm.ROLES_SECTION_NAME);
    roles.put(ADMIN_ROLE, "*");
    roles.put(ENG_ROLE, "thrift.AuroraSchedulerManager:*");
    roles.put(BACKUP_ROLE, "thrift.AuroraAdmin:listBackups");
    roles.put(DEPLOY_ROLE, "thrift.AuroraSchedulerManager:killTasks:" + ADS_STAGING_JOB.getRole() + ":"
            + ADS_STAGING_JOB.getEnvironment() + ":" + ADS_STAGING_JOB.getName());

    auroraAdmin = createMock(AnnotatedAuroraAdmin.class);
    statsProvider = createMock(StatsProvider.class);
    expect(statsProvider.makeCounter(anyString())).andStubReturn(new AtomicLong());
}

From source file:org.apache.aurora.scheduler.http.api.security.HttpSecurityIT.java

License:Apache License

@Before
public void setUp() {
    ini = new Ini();

    Ini.Section users = ini.addSection(IniRealm.USERS_SECTION_NAME);
    users.put(ROOT.getUserName(), COMMA_JOINER.join(ROOT.getPassword(), ADMIN_ROLE));
    users.put(WFARNER.getUserName(), COMMA_JOINER.join(WFARNER.getPassword(), ENG_ROLE));
    users.put(UNPRIVILEGED.getUserName(), UNPRIVILEGED.getPassword());
    users.put(BACKUP_SERVICE.getUserName(), COMMA_JOINER.join(BACKUP_SERVICE.getPassword(), BACKUP_ROLE));
    users.put(DEPLOY_SERVICE.getUserName(), COMMA_JOINER.join(DEPLOY_SERVICE.getPassword(), DEPLOY_ROLE));
    users.put(H2_USER.getUserName(), COMMA_JOINER.join(H2_USER.getPassword(), H2_ROLE));

    Ini.Section roles = ini.addSection(IniRealm.ROLES_SECTION_NAME);
    roles.put(ADMIN_ROLE, "*");
    roles.put(ENG_ROLE, "thrift.AuroraSchedulerManager:*");
    roles.put(BACKUP_ROLE, "thrift.AuroraAdmin:listBackups");
    roles.put(DEPLOY_ROLE, "thrift.AuroraSchedulerManager:killTasks:" + ADS_STAGING_JOB.getRole() + ":"
            + ADS_STAGING_JOB.getEnvironment() + ":" + ADS_STAGING_JOB.getName());
    roles.put(H2_ROLE, H2_PERM);//  www . j a va  2s . c o  m

    auroraAdmin = createMock(AnnotatedAuroraAdmin.class);
    shiroAfterAuthFilter = createMock(Filter.class);
}

From source file:org.apache.aurora.scheduler.http.api.security.ShiroIniConverterTest.java

License:Apache License

@Test
public void testDoParseOptionalSections() {
    assertEquals(ImmutableSet.of(IniRealm.ROLES_SECTION_NAME),
            parser.convert(ShiroIniConverterTest.class.getResource(MISSING_SECTIONS_SHIRO_INI).toString())
                    .getSectionNames());
}

From source file:org.apache.aurora.scheduler.http.api.security.ShiroIniParserTest.java

License:Apache License

@Test
public void testDoParseOptionalSections() {
    assertEquals(ImmutableSet.of(IniRealm.ROLES_SECTION_NAME),
            parser.doParse(ShiroIniParserTest.class.getResource(MISSING_SECTIONS_SHIRO_INI).toString())
                    .getSectionNames());
}

From source file:org.apache.isis.security.shiro.permrolemapper.PermissionToRoleMapperFromIni.java

License:Apache License

/**
 * Using the same logic as in {@link IniRealm}.
 *//*from w ww  . j  a v a2s  .co m*/
public PermissionToRoleMapperFromIni(Ini ini) {
    Map<String, String> section = ini.getSection(IniRealm.ROLES_SECTION_NAME);
    this.permissionsByRole = Maps.transformEntries(section,
            new EntryTransformer<String, String, List<String>>() {

                @Override
                public List<String> transformEntry(String key, String value) {
                    return Lists.newArrayList(PermissionUtils.toPermissionStrings(value));
                }
            });
}