Examples of IniRealm


Examples of org.apache.shiro.realm.text.IniRealm

     * @param ini the Ini instance from which to acquire the account data.
     * @return a new Realm instance reflecting the account data discovered in the {@code Ini}.
     */
    protected Realm createRealm(Ini ini) {
        //IniRealm realm = new IniRealm(ini); changed to support SHIRO-322
        IniRealm realm = new IniRealm();
        realm.setName(INI_REALM_NAME);
        realm.setIni(ini); //added for SHIRO-322
        return realm;
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

    public void testVMSingleton() {
        DefaultSecurityManager sm = new DefaultSecurityManager();
        Ini ini = new Ini();
        Ini.Section section = ini.addSection(IniRealm.USERS_SECTION_NAME);
        section.put("guest", "guest");
        sm.setRealm(new IniRealm(ini));
        SecurityUtils.setSecurityManager(sm);

        try {
            Subject subject = SecurityUtils.getSubject();
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

        sm = new DefaultSecurityManager();
        Ini ini = new Ini();
        Ini.Section section = ini.addSection(IniRealm.USERS_SECTION_NAME);
        section.put("guest", "guest, guest");
        section.put("lonestarr", "vespa, goodguy");
        sm.setRealm(new IniRealm(ini));
        SecurityUtils.setSecurityManager(sm);
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

    public void testVMSingleton() {
        DefaultSecurityManager sm = new DefaultSecurityManager();
        Ini ini = new Ini();
        Ini.Section section = ini.addSection(IniRealm.USERS_SECTION_NAME);
        section.put("guest", "guest");
        sm.setRealm(new IniRealm(ini));
        SecurityUtils.setSecurityManager(sm);

        Subject subject = SecurityUtils.getSubject();

        AuthenticationToken token = new UsernamePasswordToken("guest", "guest");
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

     *
     * @param ini the Ini instance from which to acquire the account data.
     * @return a new Realm instance reflecting the account data discovered in the {@code Ini}.
     */
    protected Realm createRealm(Ini ini) {
        IniRealm realm = new IniRealm(ini);
        realm.setName(INI_REALM_NAME);
        return realm;
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

        sm = new DefaultWebSecurityManager();
        sm.setSessionMode(DefaultWebSecurityManager.NATIVE_SESSION_MODE);
        Ini ini = new Ini();
        Ini.Section section = ini.addSection(IniRealm.USERS_SECTION_NAME);
        section.put("lonestarr", "vespa");
        sm.setRealm(new IniRealm(ini));
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

    }

    @Test(expected = AuthenticationInProgressException.class)
    public void testAfterAttempt() throws Exception {

        final Realm otherRealm = new IniRealm();

        this.authStrategy.afterAttempt(otherRealm, null, null, null, new RuntimeException());

        final AuthenticationInProgressException authInProgressException = new AuthenticationInProgressException();
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

        //should build IniEnvironment from shiro.ini in the classpath at the least:
        ShiroPlugin plugin = new ShiroPlugin();
        plugin.installPlugin(new MutableBrokerFilter(null));

        Ini ini = Ini.fromResourcePath("classpath:shiro.ini");
        IniRealm realm = (IniRealm) ((DefaultSecurityManager) plugin.getEnvironment().getSecurityManager()).getRealms().iterator().next();
        assertEquals(ini, realm.getIni());
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

        ShiroPlugin plugin = new ShiroPlugin();
        Ini ini = Ini.fromResourcePath("classpath:minimal.shiro.ini");
        plugin.setIni(ini);
        plugin.installPlugin(new MutableBrokerFilter(null));

        IniRealm realm = (IniRealm) ((DefaultSecurityManager) plugin.getEnvironment().getSecurityManager()).getRealms().iterator().next();
        assertSame(ini, realm.getIni());
    }
View Full Code Here

Examples of org.apache.shiro.realm.text.IniRealm

                "system = manager, system\n" +
                "[roles]\n" +
                "system = *");
        plugin.installPlugin(new MutableBrokerFilter(null));

        IniRealm realm = (IniRealm) ((DefaultSecurityManager) plugin.getEnvironment().getSecurityManager()).getRealms().iterator().next();
        Ini ini = realm.getIni();
        assertEquals(1, ini.getSection("users").size());
        assertEquals("manager, system", ini.getSection("users").get("system"));
        assertEquals(1, ini.getSection("roles").size());
        assertEquals("*", ini.getSection("roles").get("system"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.