当前位置: 首页>>代码示例>>Java>>正文


Java RolePermissionResolver类代码示例

本文整理汇总了Java中org.apache.shiro.authz.permission.RolePermissionResolver的典型用法代码示例。如果您正苦于以下问题:Java RolePermissionResolver类的具体用法?Java RolePermissionResolver怎么用?Java RolePermissionResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RolePermissionResolver类属于org.apache.shiro.authz.permission包,在下文中一共展示了RolePermissionResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ClothoRealm

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Inject
public ClothoRealm(CredentialStore store, RolePermissionResolver roleResolver) {
    super();
    
    //XXX: up number of iterations
    HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(Sha256Hash.ALGORITHM_NAME);
    matcher.setStoredCredentialsHexEncoded(false);
    
    this.store = store;
    setAuthenticationTokenClass(UsernamePasswordToken.class);
    setCredentialsMatcher(matcher);

    setRolePermissionResolver(roleResolver);

    setUpRealm();
}
 
开发者ID:CIDARLAB,项目名称:clotho3crud,代码行数:17,代码来源:ClothoRealm.java

示例2: resolveRolePermissions

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
private Collection<Permission> resolveRolePermissions(
		Collection<String> roleNames) {
	Collection<Permission> perms = Collections.emptySet();
	RolePermissionResolver resolver = getRolePermissionResolver();
	if (resolver != null && !CollectionUtils.isEmpty(roleNames)) {
		perms = new LinkedHashSet<Permission>(roleNames.size());
		for (String roleName : roleNames) {
			Collection<Permission> resolved = resolver
					.resolvePermissionsInRole(roleName);
			if (!CollectionUtils.isEmpty(resolved)) {
				perms.addAll(resolved);
			}
		}
	}
	return perms;
}
 
开发者ID:StarterInc,项目名称:Ignite,代码行数:17,代码来源:RoleSecurityJdbcRealm.java

示例3: start

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@BeforeClass
public static void start() throws Exception {
    securityManager = new DefaultSecurityManager();
    SecurityUtils.setSecurityManager(securityManager);


    realm = new SimpleAccountRealm("test-realm");
    realm.addRole("role");
    realm.addAccount("foo", "bar", "role");
    realm.addAccount("bilbo", "precious", "hobbit");
    realm.setRolePermissionResolver(new RolePermissionResolver() {
        public Collection<Permission> resolvePermissionsInRole(String roleString) {
            if ("role".equals(roleString)) {
                final Permission dp = new WildcardPermission("permission");
                return Arrays.asList(dp);
            }
            return Collections.emptyList();
        }
    });
    securityManager.setRealm(realm);
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.shiro,代码行数:22,代码来源:AbstractCdiTest.java

示例4: createRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
private RolePermissionResolver createRolePermissionResolver() {
    return new RolePermissionResolver () {
        @Override
        public Collection<Permission> resolvePermissionsInRole(String role) {
            return getRolePermissions(role);
        }
    };
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:9,代码来源:ApiKeyRealm.java

示例5: resolveRolePermissions

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
/**
 * 此方法 Copy 自父类,没有改变任何代码
 * @param roleNames
 * @return
 */
private Collection<Permission> resolveRolePermissions(Collection<String> roleNames) {
	Collection<Permission> perms = Collections.emptySet();
	RolePermissionResolver resolver = getRolePermissionResolver();
	if (resolver != null && !CollectionUtils.isEmpty(roleNames)) {
		perms = new LinkedHashSet<>(roleNames.size());
		for (String roleName : roleNames) {
			Collection<Permission> resolved = resolver.resolvePermissionsInRole(roleName);
			if (!CollectionUtils.isEmpty(resolved)) {
				perms.addAll(resolved);
			}
		}
	}
	return perms;
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:20,代码来源:DefaultCasRealm.java

示例6: ExceptionCatchingModularRealmAuthorizer

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Inject
public ExceptionCatchingModularRealmAuthorizer(final Collection<Realm> realms, 
                                               final Provider<RolePermissionResolver> rolePermissionResolverProvider)
{
  this.rolePermissionResolverProvider = rolePermissionResolverProvider;
  setRealms(realms);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:8,代码来源:ExceptionCatchingModularRealmAuthorizer.java

示例7: setUp

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  realm = (AuthorizingRealmImpl) lookup(Realm.class, AuthorizingRealmImpl.NAME);
  realm.setRolePermissionResolver(this.lookup(RolePermissionResolver.class));

  configurationManager = lookup(SecurityConfigurationManagerImpl.class);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:10,代码来源:AuthorizingRealmImplTest.java

示例8: getRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Override
public RolePermissionResolver getRolePermissionResolver() {
  return rolePermissionResolverProvider != null ? rolePermissionResolverProvider.get() : null;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:5,代码来源:ExceptionCatchingModularRealmAuthorizer.java

示例9: setRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Override
public void setRolePermissionResolver(RolePermissionResolver rpr) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:luozhengjie,项目名称:RLCMS,代码行数:6,代码来源:RLCMSAuthenticationInfo.java

示例10: configure

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(ClothoConnection.class).to(JongoConnection.class);
    bind(CredentialStore.class).to(JongoConnection.class);
    bind(RolePermissionResolver.class).to(JongoConnection.class);
}
 
开发者ID:CIDARLAB,项目名称:clotho3crud,代码行数:7,代码来源:JongoModule.java

示例11: onInit

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
@Override
public void onInit() {
	if (LOG.isTraceEnabled()) {
		LOG.trace("Initializing the '"
				+ MapDbAuthorizingRealm.class.getSimpleName() + "'.");
	}

	super.onInit();

	// create the maker of the database and create it
	final DBMaker<?> maker = DBMaker.newFileDB(location);
	maker.cacheHardRefEnable();
	maker.cacheLRUEnable();
	maker.cacheSize(1000);
	maker.closeOnJvmShutdown();
	db = maker.make();

	// create the maker for the specific maps of users and roles
	final HTreeMapMaker usersMapMaker = db.createHashMap("users");
	final HTreeMapMaker rolesMapMaker = db.createHashMap("roles");
	this.users = usersMapMaker.makeOrGet();
	this.roles = rolesMapMaker.makeOrGet();

	// disable any caching
	setCachingEnabled(false);
	setCacheManager(null);

	// add a role resolver
	setRolePermissionResolver(new RolePermissionResolver() {

		@Override
		public Collection<Permission> resolvePermissionsInRole(
				final String role) {

			final SimpleRole r = roles.get(role);
			if (r == null) {
				return null;
			} else {
				return r.getPermissions();
			}
		}
	});

	checkAdministrator();
}
 
开发者ID:pmeisen,项目名称:dis-timeintervaldataanalyzer,代码行数:46,代码来源:MapDbAuthorizingRealm.java

示例12: applyRolePermissionResolverToRealms

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
/**
 * Sets the internal {@link #getRolePermissionResolver} on any internal configured
 * {@link #getRealms Realms} that implement the {@link org.apache.shiro.authz.permission.RolePermissionResolverAware RolePermissionResolverAware} interface.
 * <p/>
 * This method is called after setting a rolePermissionResolver on this ModularRealmAuthorizer via the
 * {@link #setRolePermissionResolver(org.apache.shiro.authz.permission.RolePermissionResolver) setRolePermissionResolver} method.
 * <p/>
 * It is also called after setting one or more realms via the {@link #setRealms setRealms} method to allow these
 * newly available realms to be given the <code>RolePermissionResolver</code> already in use.
 *
 * @since 1.0
 */
protected void applyRolePermissionResolverToRealms() {
    RolePermissionResolver resolver = getRolePermissionResolver();
    Collection<Realm> realms = getRealms();
    if (resolver != null && realms != null && !realms.isEmpty()) {
        for (Realm realm : realms) {
            if (realm instanceof RolePermissionResolverAware) {
                ((RolePermissionResolverAware) realm).setRolePermissionResolver(resolver);
            }
        }
    }
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:24,代码来源:ModularRealmAuthorizer.java

示例13: getRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
/**
 * Returns the RolePermissionResolver to be used on <em>all</em> configured realms, or <code>null</code (the default)
 * if all realm instances will each configure their own permission resolver.
 *
 * @return the RolePermissionResolver to be used on <em>all</em> configured realms, or <code>null</code (the default)
 *         if realm instances will each configure their own role permission resolver.
 * @since 1.0
 */
public RolePermissionResolver getRolePermissionResolver() {
    return this.rolePermissionResolver;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:12,代码来源:ModularRealmAuthorizer.java

示例14: setRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
/**
 * Sets the specified {@link RolePermissionResolver RolePermissionResolver} on <em>all</em> of the wrapped realms that
 * implement the {@link org.apache.shiro.authz.permission.RolePermissionResolverAware PermissionResolverAware} interface.
 * <p/>
 * Only call this method if you want the permission resolver to be passed to all realms that implement the
 * <code>RolePermissionResolver</code> interface.  If you do not want this to occur, the realms must
 * configure themselves individually (or be configured individually).
 *
 * @param rolePermissionResolver the rolePermissionResolver to set on all of the wrapped realms that implement the
 *                               {@link org.apache.shiro.authz.permission.RolePermissionResolverAware RolePermissionResolverAware} interface.
 */
public void setRolePermissionResolver(RolePermissionResolver rolePermissionResolver) {
    this.rolePermissionResolver = rolePermissionResolver;
    applyRolePermissionResolverToRealms();
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:16,代码来源:ModularRealmAuthorizer.java

示例15: getRolePermissionResolver

import org.apache.shiro.authz.permission.RolePermissionResolver; //导入依赖的package包/类
/**
 * Overridden because the OpalSecurityManager sets {@code this} as the {@code RolePermissionResolver} on all configured
 * realms. This results the following object graph:
 * <p/>
 * <pre>
 * AuthorizingReam.rolePermissionResolver -> MicaAuthorizingRealm (this)
 *      ^
 *      |
 * MicaAuthorizingRealm.rolePermissionResolver -> GroupPermissionResolver
 *
 * <pre>
 * By overriding this method, we prevent an infinite loop from occurring when
 * {@code getRolePermissionResolver().resolvePermissionsInRole()} is called.
 */
@Override
public RolePermissionResolver getRolePermissionResolver() {
  return rolePermissionResolver;
}
 
开发者ID:obiba,项目名称:mica2,代码行数:19,代码来源:MicaAuthorizingRealm.java


注:本文中的org.apache.shiro.authz.permission.RolePermissionResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。