org.apache.shiro.authz.permission.WildcardPermissionResolver.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.apache.shiro.authz.permission.WildcardPermissionResolver.<init>()方法的一些代码示例,展示了WildcardPermissionResolver.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WildcardPermissionResolver.<init>()方法的具体详情如下:
包路径:org.apache.shiro.authz.permission.WildcardPermissionResolver
类名称:WildcardPermissionResolver
方法名:<init>

WildcardPermissionResolver.<init>介绍

[英]Default constructor. Equivalent to calling WildcardPermissionResolver(false)
[中]默认构造函数。相当于调用WildcardPermissionResolver(false)

代码示例

代码示例来源:origin: apache/shiro

public AuthorizingRealm(CacheManager cacheManager, CredentialsMatcher matcher) {
  super();
  if (cacheManager != null) setCacheManager(cacheManager);
  if (matcher != null) setCredentialsMatcher(matcher);
  this.authorizationCachingEnabled = true;
  this.permissionResolver = new WildcardPermissionResolver();
  int instanceNumber = INSTANCE_COUNT.getAndIncrement();
  this.authorizationCacheName = getClass().getName() + DEFAULT_AUTHORIZATION_CACHE_SUFFIX;
  if (instanceNumber > 0) {
    this.authorizationCacheName = this.authorizationCacheName + "." + instanceNumber;
  }
}

代码示例来源:origin: apache/shiro

@Test
public void testCaseInsensitive()
{
  WildcardPermissionResolver resolver = new WildcardPermissionResolver(false);
  assertFalse( "Sensitivity should be false", resolver.isCaseSensitive());
  /* this is a round-about test as permissions don't store case sensitivity just lower case 
  the string. */
  WildcardPermission permission = (WildcardPermission) resolver.resolvePermission( "Foo:*" );
  assertEquals( "string should be lowercase", "foo:*", permission.toString());
}

代码示例来源:origin: apache/shiro

@Test
public void testDefaultIsNonCaseSensitive()
{
  WildcardPermissionResolver resolver = new WildcardPermissionResolver();
  assertFalse( "Default sensitivity should be false", resolver.isCaseSensitive());
  /* this is a round-about test as permissions don't store case sensitivity just lower case 
  the string. */
  WildcardPermission permission = (WildcardPermission) resolver.resolvePermission( "Foo:*" );
  assertEquals( "string should be lowercase", "foo:*", permission.toString());
}

代码示例来源:origin: apache/shiro

@Test
public void testCaseSensitive()
{
  WildcardPermissionResolver resolver = new WildcardPermissionResolver(true);
  assertTrue( "Sensitivity should be true", resolver.isCaseSensitive());
  /* this is a round-about test as permissions don't store case sensitivity just lower case 
  the string. */
  WildcardPermission permission = (WildcardPermission) resolver.resolvePermission( "Foo:*" );
  assertEquals( "string should be mixed case", "Foo:*", permission.toString());
}

代码示例来源:origin: apache/shiro

@Test
public void testCaseSensitiveToggle()
{
  WildcardPermissionResolver resolver = new WildcardPermissionResolver();
  assertFalse( "Default sensitivity should be false", resolver.isCaseSensitive());
  resolver.setCaseSensitive( true );
  assertTrue( "Sensitivity should be true", resolver.isCaseSensitive());
  resolver.setCaseSensitive( false );
  assertFalse( "Sensitivity should be false", resolver.isCaseSensitive());
}

代码示例来源:origin: org.apache.shiro/shiro-core

public AuthorizingRealm(CacheManager cacheManager, CredentialsMatcher matcher) {
  super();
  if (cacheManager != null) setCacheManager(cacheManager);
  if (matcher != null) setCredentialsMatcher(matcher);
  this.authorizationCachingEnabled = true;
  this.permissionResolver = new WildcardPermissionResolver();
  int instanceNumber = INSTANCE_COUNT.getAndIncrement();
  this.authorizationCacheName = getClass().getName() + DEFAULT_AUTHORIZATION_CACHE_SUFFIX;
  if (instanceNumber > 0) {
    this.authorizationCacheName = this.authorizationCacheName + "." + instanceNumber;
  }
}

代码示例来源:origin: stormpath/stormpath-shiro

/**
 * Creates a new instance, using the default {@link #getCustomDataFieldName() customDataFieldName} of
 * {@code apacheShiroPermissions} and a default {@link WildcardPermissionResolver}.
 */
public CustomDataPermissionResolver() {
  this.customDataFieldName = CustomDataPermissionsEditor.DEFAULT_CUSTOM_DATA_FIELD_NAME;
  this.permissionResolver = new WildcardPermissionResolver();
}

代码示例来源:origin: stackoverflow.com

package org.apache.shiro.samples.web;

import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.*;

import java.util.Collection;
import java.util.Collections;

public class SimpleRolePermissionResolver implements RolePermissionResolver, PermissionResolverAware {

  private PermissionResolver permissionResolver = new WildcardPermissionResolver();

  public void setPermissionResolver(PermissionResolver permissionResolver) {
    this.permissionResolver = permissionResolver;
  }

  public Collection<Permission> resolvePermissionsInRole(String roleString) {
    return Collections.<Permission>singleton(permissionResolver.resolvePermission(roleString));
  }
}

代码示例来源:origin: com.stormpath.shiro/stormpath-shiro-core

/**
 * Creates a new instance, using the default {@link #getCustomDataFieldName() customDataFieldName} of
 * {@code apacheShiroPermissions} and a default {@link WildcardPermissionResolver}.
 */
public CustomDataPermissionResolver() {
  this.customDataFieldName = CustomDataPermissionsEditor.DEFAULT_CUSTOM_DATA_FIELD_NAME;
  this.permissionResolver = new WildcardPermissionResolver();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

public AuthorizingRealm() {
  this.authorizationCachingEnabled = true;
  this.permissionResolver = new WildcardPermissionResolver();
  int instanceNumber = INSTANCE_COUNT.getAndIncrement();
  this.authorizationCacheName = getClass().getName() + DEFAULT_AUTHORIZATION_CACHE_SUFFIX;
  if (instanceNumber > 0) {
    this.authorizationCacheName = this.authorizationCacheName + "." + instanceNumber;
  }
}

代码示例来源:origin: Rekoe/rk_svnadmin

public static void main(String[] args) {
    PermissionResolver permissionResolver = new WildcardPermissionResolver();

    System.out.println(permissionResolver.resolvePermission("*:*:*").implies(permissionResolver.resolvePermission("game.server")));
  }
}

代码示例来源:origin: org.restcomm/restcomm-connect.http

WildcardPermissionResolver resolver = new WildcardPermissionResolver();
Permission neededPermission = resolver.resolvePermission(neededPermissionString);

相关文章