當前位置: 首頁>>代碼示例>>Java>>正文


Java Realm.getName方法代碼示例

本文整理匯總了Java中org.apache.shiro.realm.Realm.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Realm.getName方法的具體用法?Java Realm.getName怎麽用?Java Realm.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.shiro.realm.Realm的用法示例。


在下文中一共展示了Realm.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRealms

import org.apache.shiro.realm.Realm; //導入方法依賴的package包/類
private Collection<Realm> getRealms(Map<String, ?> instances) {

        //realms and realm factory might have been created - pull them out first so we can
        //initialize the securityManager:
        List<Realm> realms = new ArrayList<Realm>();

        //iterate over the map entries to pull out the realm factory(s):
        for (Map.Entry<String, ?> entry : instances.entrySet()) {

            String name = entry.getKey();
            Object value = entry.getValue();

            if (value instanceof RealmFactory) {
                addToRealms(realms, (RealmFactory) value);
            } else if (value instanceof Realm) {
                Realm realm = (Realm) value;
                //set the name if null:
                String existingName = realm.getName();
                if (existingName == null || existingName.startsWith(realm.getClass().getName())) {
                    if (realm instanceof Nameable) {
                        ((Nameable) realm).setName(name);
                        log.debug("Applied name '{}' to Nameable realm instance {}", name, realm);
                    } else {
                        log.info("Realm does not implement the {} interface.  Configured name will not be applied.",
                                Nameable.class.getName());
                    }
                }
                realms.add(realm);
            }
        }

        return realms;
    }
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:34,代碼來源:IniSecurityManagerFactory.java

示例2: getRealm

import org.apache.shiro.realm.Realm; //導入方法依賴的package包/類
public static GwtUtilRealm getRealm() throws LogicException {
    Iterator<Realm> realms = ((RealmSecurityManager) SecurityUtils.getSecurityManager()).getRealms().iterator();
    Realm realm = realms.next();
    if (!(realm instanceof GwtUtilRealm)) {
        throw new LogicException(
                "Realm " + realm.getName() + " isn't compatible to GwtUtilRealm, its type is: " + realm.getClass().getSimpleName());
    }
    return (GwtUtilRealm) realm;
}
 
開發者ID:rkfg,項目名稱:gwtutil,代碼行數:10,代碼來源:AuthServiceImpl.java

示例3: bindRealm

import org.apache.shiro.realm.Realm; //導入方法依賴的package包/類
/**
 * Binds the {@link Realm} to the security manager.
 *
 * @param realm
 *      the {@link Realm} to be binded
 */
protected void bindRealm(Realm realm) {
    synchronized (LOCK) {
        String serviceName = realm.getName();
        assertServiceNameValid(serviceName);
        if (!realms.containsKey(serviceName)) {
            realms.put(serviceName, realm);
            synchronizeRealms();
        } else {
            String msg = "There is already registered service with the same name: " +
                    serviceName;
            log.warn(msg);
        }
    }
}
 
開發者ID:panifex,項目名稱:panifex-platform,代碼行數:21,代碼來源:ModularWebEnvironment.java

示例4: ShiroAuthProviderImpl

import org.apache.shiro.realm.Realm; //導入方法依賴的package包/類
public ShiroAuthProviderImpl(Vertx vertx, Realm realm) {
  this.vertx = vertx;
  this.securityManager = new DefaultSecurityManager(realm);
  this.realmName = realm.getName();
}
 
開發者ID:vert-x3,項目名稱:vertx-auth,代碼行數:6,代碼來源:ShiroAuthProviderImpl.java


注:本文中的org.apache.shiro.realm.Realm.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。