Package org.apache.shiro.config

Examples of org.apache.shiro.config.Ini


  public static Ini loadFromPath(FileSystem fileSystem, Path path) throws IOException {
    InputStream inputStream = null;
    try {
      LOGGER.info("Opening " + path);
      inputStream = fileSystem.open(path);
      Ini ini = new Ini();
      ini.load(inputStream);
      return ini;
    } finally {
      if(inputStream != null) {
        try {
          inputStream.close();
View Full Code Here


     * Test that ensures the WebIniSecurityManagerFactory will automatically add the default
     * filters to the pool of beans before the INI configuration is interpreted.
     */
    @Test
    public void testDefaultFiltersPresent() {
        Ini ini = new Ini();
        //just a normal configuration line in the MAIN section for any of the default filtes should work
        //out of the box.  So, create the main section and just config one of them:
        Ini.Section section = ini.addSection(IniSecurityManagerFactory.MAIN_SECTION_NAME);
        section.put("authc.loginUrl", "/login.jsp");

        WebIniSecurityManagerFactory factory = new WebIniSecurityManagerFactory(ini);
        org.apache.shiro.mgt.SecurityManager sm = factory.getInstance();
        assertNotNull(sm);
View Full Code Here

    @Before
    public void setup() {
        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

     * Asserts fix for <a href="https://issues.apache.org/jira/browse/SHIRO-350">SHIRO-350</a>.
     */
    @Test
    public void testBuildNonWebSubjectWithDefaultServletContainerSessionManager() {

        Ini ini = new Ini();
        Ini.Section section = ini.addSection(IniRealm.USERS_SECTION_NAME);
        section.put("user1", "user1");

        WebIniSecurityManagerFactory factory = new WebIniSecurityManagerFactory(ini);

        WebSecurityManager securityManager = (WebSecurityManager)factory.getInstance();
View Full Code Here

    }

    @Test
    public void testRunAs() {

        Ini ini = new Ini();
        Ini.Section users = ini.addSection("users");
        users.put("user1", "user1,role1");
        users.put("user2", "user2,role2");
        users.put("user3", "user3,role3");
        IniSecurityManagerFactory factory = new IniSecurityManagerFactory(ini);
        SecurityManager sm = factory.getInstance();
View Full Code Here

            setConfigPath(configPath);
        }
    }

    protected void configure() throws Exception {
        Ini ini = loadIniFromConfig();

        if (CollectionUtils.isEmpty(ini)) {
            log.info("Null or empty configuration specified via 'config' init-param.  " +
                    "Checking path-based configuration.");
            ini = loadIniFromPath();
View Full Code Here

        Map<String, ?> objects = applySecurityManager(ini);
        applyFilterChainResolver(ini, objects);
    }

    protected Ini loadIniFromConfig() {
        Ini ini = null;
        String config = getConfig();
        if (config != null) {
            ini = convertConfigToIni(config);
        }
        return ini;
View Full Code Here

        }
        return ini;
    }

    protected Ini loadIniFromPath() {
        Ini ini = null;
        String path = getConfigPath();
        if (path != null) {
            ini = convertPathToIni(path);
        }
        return ini;
View Full Code Here

            setFilterChainResolver(resolver);
        }
    }

    protected Ini convertConfigToIni(String config) {
        Ini ini = new Ini();
        ini.load(config);
        return ini;
    }
View Full Code Here

    /**
     * Initializes this instance by resolving any potential (explicit or resource-configured) {@link Ini}
     * configuration and calling {@link #configure() configure} for actual instance configuration.
     */
    public void init() {
        Ini ini = getIni();

        String[] configLocations = getConfigLocations();

        if (log.isWarnEnabled() && !CollectionUtils.isEmpty(ini) &&
                configLocations != null && configLocations.length > 0) {
View Full Code Here

TOP

Related Classes of org.apache.shiro.config.Ini

Copyright © 2018 www.massapicom. 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.