Search in sources :

Example 1 with RealmSecurityManager

use of org.apache.shiro.mgt.RealmSecurityManager in project shiro by apache.

the class IniSecurityManagerFactory method isAutoApplyRealms.

protected boolean isAutoApplyRealms(SecurityManager securityManager) {
    boolean autoApply = true;
    if (securityManager instanceof RealmSecurityManager) {
        // only apply realms if they haven't been explicitly set by the user:
        RealmSecurityManager realmSecurityManager = (RealmSecurityManager) securityManager;
        Collection<Realm> realms = realmSecurityManager.getRealms();
        if (!CollectionUtils.isEmpty(realms)) {
            log.info("Realms have been explicitly set on the SecurityManager instance - auto-setting of " + "realms will not occur.");
            autoApply = false;
        }
    }
    return autoApply;
}
Also used : RealmSecurityManager(org.apache.shiro.mgt.RealmSecurityManager) IniRealm(org.apache.shiro.realm.text.IniRealm) Realm(org.apache.shiro.realm.Realm)

Aggregations

RealmSecurityManager (org.apache.shiro.mgt.RealmSecurityManager)1 Realm (org.apache.shiro.realm.Realm)1 IniRealm (org.apache.shiro.realm.text.IniRealm)1