本文整理汇总了Java中org.apache.shiro.config.Ini.addSection方法的典型用法代码示例。如果您正苦于以下问题:Java Ini.addSection方法的具体用法?Java Ini.addSection怎么用?Java Ini.addSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.config.Ini
的用法示例。
在下文中一共展示了Ini.addSection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupShiro
import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
private static void setupShiro() {
Ini ini = new Ini();
Ini.Section usersSection = ini.addSection("users");
usersSection.put(ALICE.email(), ALICE.roles());
usersSection.put(BOB.email(), BOB.roles());
usersSection.put(CAESAR.email(), CAESAR.roles());
Ini.Section rolesSection = ini.addSection("roles");
rolesSection.put(ROLE_A.label(), ROLE_A.permissions());
rolesSection.put(ROLE_B.label(), ROLE_B.permissions());
rolesSection.put(ROLE_C.label(), ROLE_C.permissions());
rolesSection.put(ROLE_D.label(), ROLE_D.permissions());
Factory<SecurityManager> factory = new TestIniSecurityManagerFactory(ini);
SecurityManager secMgr = factory.getInstance();
setSecurityManager(secMgr);
}
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:19,代码来源:AbstractThymeleafShiroDialectTest.java
示例2: setUp
import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@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);
auroraAdmin = createMock(AnnotatedAuroraAdmin.class);
shiroAfterAuthFilter = createMock(Filter.class);
}
示例3: beforeClass
import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
//Set up shiro
Ini ini = new Ini();
Ini.Section usersSection = ini.addSection("users");
usersSection.put(USER1, PASS1 + ",rolea,roled");
usersSection.put(USER2, PASS2 + ",roleb,rolec");
usersSection.put(USER3, PASS3 + ",rolec,rolee");
Ini.Section rolesSection = ini.addSection("roles");
rolesSection.put("rolea", "*");
rolesSection.put("roleb", "permtype1:permaction1:perminst1");
rolesSection.put("rolec", "permtype1:permaction2:*");
rolesSection.put("roled", "permtype3:*");
Factory<SecurityManager> factory = new TestIniSecurityManagerFactory(ini);
SecurityManager secMgr = factory.getInstance();
setSecurityManager(secMgr);
//Set up thymeleaf
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setCacheable(false);
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setTemplateMode("HTML5");
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.addDialect("shiro", new ShiroDialect());
}
示例4: setupShiro
import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
private static void setupShiro() {
Ini ini = new Ini();
Ini.Section usersSection = ini.addSection("users");
usersSection.put(USER1, PASS1 + ",rolea,roled");
usersSection.put(USER2, PASS2 + ",roleb,rolec");
usersSection.put(USER3, PASS3 + ",rolec,rolee");
Ini.Section rolesSection = ini.addSection("roles");
rolesSection.put("rolea", "*");
rolesSection.put("roleb", "permtype1:permaction1:perminst1");
rolesSection.put("rolec", "permtype1:permaction2:*");
rolesSection.put("roled", "permtype3:*");
Factory<SecurityManager> factory = new TestIniSecurityManagerFactory(ini);
SecurityManager secMgr = factory.getInstance();
setSecurityManager(secMgr);
}