Example usage for org.apache.shiro.realm.text PropertiesRealm setResourcePath

List of usage examples for org.apache.shiro.realm.text PropertiesRealm setResourcePath

Introduction

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

Prototype

public void setResourcePath(String resourcePath) 

Source Link

Document

Sets the path of the properties file to load user, role, and permission information from.

Usage

From source file:io.vertx.ext.auth.impl.realms.PropertiesAuthRealm.java

License:Open Source License

@Override
public void init(JsonObject config) {
    this.config = config;
    PropertiesRealm propsRealm = new PropertiesRealm();
    String resourcePath = config.getString(PROPERTIES_PROPS_PATH_FIELD);
    if (resourcePath != null) {
        propsRealm.setResourcePath(resourcePath);
    } else {//from w  w w .  j  av  a  2 s . c  om
        propsRealm.setResourcePath("classpath:vertx-users.properties");
    }
    propsRealm.init();
    this.securityManager = new DefaultSecurityManager(propsRealm);
    this.realm = propsRealm;
}

From source file:io.vertx.ext.auth.shiro.impl.PropertiesAuthProvider.java

License:Open Source License

public static Realm createRealm(JsonObject config) {
    PropertiesRealm propsRealm = new PropertiesRealm();
    String resourcePath = config.getString(PROPERTIES_PROPS_PATH_FIELD);
    if (resourcePath != null) {
        propsRealm.setResourcePath(resolve(resourcePath));
    } else {/*  www.  ja v a  2s .com*/
        propsRealm.setResourcePath("classpath:vertx-users.properties");
    }
    propsRealm.init();
    return propsRealm;
}

From source file:io.vertx.ext.auth.shiro.impl.PropertiesAuthRealm.java

License:Open Source License

public PropertiesAuthRealm(JsonObject config) {
    PropertiesRealm propsRealm = new PropertiesRealm();
    String resourcePath = config.getString(PROPERTIES_PROPS_PATH_FIELD);
    if (resourcePath != null) {
        propsRealm.setResourcePath(resourcePath);
    } else {//ww  w.  j a v a  2 s.c o  m
        propsRealm.setResourcePath("classpath:vertx-users.properties");
    }
    propsRealm.init();
    this.securityManager = new DefaultSecurityManager(propsRealm);
    this.realm = propsRealm;
}

From source file:org.codehaus.griffon.runtime.shiro.DefaultSecurityManagerFactory.java

License:Apache License

public SecurityManager createSecurityManager(GriffonApplication app) {
    PropertiesRealm realm = new PropertiesRealm();
    String resourcePath = ConfigUtils.getConfigValueAsString(app.getConfig(), KEY_REALM_RESOURCE_PATH,
            DEFAULT_REALM_RESOURCE_PATH);
    realm.setResourcePath(resourcePath);
    realm.init();//from ww w.  j av  a  2  s .com
    return new DefaultSecurityManager(realm);
}

From source file:org.codehaus.griffon.runtime.shiro.SecurityManagerProvider.java

License:Apache License

@Override
public SecurityManager get() {
    PropertiesRealm realm = new PropertiesRealm();
    String resourcePath = configuration.getAsString(KEY_REALM_RESOURCE_PATH, DEFAULT_REALM_RESOURCE_PATH);
    realm.setResourcePath(resourcePath);
    realm.init();/*from w  w  w  .java  2s. c  om*/
    return new DefaultSecurityManager(realm);
}

From source file:org.debux.webmotion.shiro.ShiroListener.java

License:Open Source License

/**
 * @return basic realm in properties file on classpath
 *//*  w  ww  .  j  a va  2 s. co  m*/
protected Realm getRealm() {
    PropertiesRealm realm = new PropertiesRealm();
    realm.setResourcePath("classpath:shiro.properties");
    realm.init();
    return realm;
}