当前位置: 首页>>代码示例>>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;未经允许,请勿转载。