Search in sources :

Example 1 with Ini

use of org.apache.shiro.config.Ini in project killbill by killbill.

the class EntitlementTestSuiteWithEmbeddedDB method configureShiro.

protected void configureShiro() {
    final Ini config = new Ini();
    config.addSection("users");
    config.getSection("users").put("EntitlementUser", "password, entitlement");
    config.addSection("roles");
    config.getSection("roles").put("entitlement", Permission.ACCOUNT_CAN_CREATE.toString() + "," + Permission.ENTITLEMENT_CAN_CREATE.toString() + "," + Permission.ENTITLEMENT_CAN_CHANGE_PLAN.toString() + "," + Permission.ENTITLEMENT_CAN_PAUSE_RESUME.toString() + "," + Permission.ENTITLEMENT_CAN_TRANSFER.toString() + "," + Permission.ENTITLEMENT_CAN_CANCEL.toString());
    // Reset the security manager
    ThreadContext.unbindSecurityManager();
    final Factory<SecurityManager> factory = new IniSecurityManagerFactory(config);
    final SecurityManager securityManager = factory.getInstance();
    SecurityUtils.setSecurityManager(securityManager);
}
Also used : IniSecurityManagerFactory(org.apache.shiro.config.IniSecurityManagerFactory) SecurityManager(org.apache.shiro.mgt.SecurityManager) Ini(org.apache.shiro.config.Ini)

Example 2 with Ini

use of org.apache.shiro.config.Ini in project killbill by killbill.

the class UtilTestSuiteNoDB method configureShiro.

protected void configureShiro() {
    final Ini config = new Ini();
    config.addSection("users");
    config.getSection("users").put("pierre", "password, creditor");
    config.getSection("users").put("stephane", "password, refunder");
    config.addSection("roles");
    config.getSection("roles").put("creditor", Permission.INVOICE_CAN_CREDIT.toString() + "," + Permission.INVOICE_CAN_ITEM_ADJUST.toString());
    config.getSection("roles").put("refunder", Permission.PAYMENT_CAN_REFUND.toString());
    // Reset the security manager
    ThreadContext.unbindSecurityManager();
    final Factory<SecurityManager> factory = new IniSecurityManagerFactory(config);
    final SecurityManager securityManager = factory.getInstance();
    SecurityUtils.setSecurityManager(securityManager);
}
Also used : IniSecurityManagerFactory(org.apache.shiro.config.IniSecurityManagerFactory) SecurityManager(org.apache.shiro.mgt.SecurityManager) Ini(org.apache.shiro.config.Ini)

Aggregations

Ini (org.apache.shiro.config.Ini)2 IniSecurityManagerFactory (org.apache.shiro.config.IniSecurityManagerFactory)2 SecurityManager (org.apache.shiro.mgt.SecurityManager)2