本文整理汇总了Java中org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver类的典型用法代码示例。如果您正苦于以下问题:Java PathMatchingFilterChainResolver类的具体用法?Java PathMatchingFilterChainResolver怎么用?Java PathMatchingFilterChainResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PathMatchingFilterChainResolver类属于org.apache.shiro.web.filter.mgt包,在下文中一共展示了PathMatchingFilterChainResolver类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInstance
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
protected AbstractShiroFilter createInstance() throws Exception {
SecurityManager securityManager = getSecurityManager();
if (securityManager == null){
throw new BeanInitializationException("SecurityManager property must be set.");
}
if (!(securityManager instanceof WebSecurityManager)){
throw new BeanInitializationException("The security manager does not implement the WebSecurityManager interface.");
}
PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
FilterChainManager chainManager = createFilterChainManager();
chainResolver.setFilterChainManager(chainManager);
return new MySpringShiroFilter((WebSecurityManager)securityManager, chainResolver);
}
示例2: createChainResolver
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createChainResolver(Map<String, Filter> chainFilters) {
DefaultFilterChainManager chainManager = new DefaultFilterChainManager();
// load filters
chainFilters.forEach((name, filter) -> chainManager.addFilter(name, filter));
if (urls != null) {
urls.forEach((url, value) -> {
LOGGER.info("Loading url chain {} -> {}", url, value);
chainManager.createChain(url, value);
});
}
PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
resolver.setFilterChainManager(chainManager);
return resolver;
}
示例3: configureShiroWeb
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
protected void configureShiroWeb() {
bindRealm().to(EmptyRealm.class); // not used in practice, just here to keep Shiro module happy
bindSingleton(SessionFactory.class, NexusSessionFactory.class);
bindSingleton(SessionStorageEvaluator.class, NexusSessionStorageEvaluator.class);
bindSingleton(SubjectDAO.class, NexusSubjectDAO.class);
// configure our preferred security components
bindSingleton(SessionDAO.class, NexusSessionDAO.class);
bindSingleton(Authenticator.class, FirstSuccessfulModularRealmAuthenticator.class);
bindSingleton(Authorizer.class, ExceptionCatchingModularRealmAuthorizer.class);
bindSingleton(FilterChainManager.class, DynamicFilterChainManager.class);
// path matching resolver has several constructors so we need to point Guice to the appropriate one
bind(FilterChainResolver.class).toConstructor(ctor(PathMatchingFilterChainResolver.class)).asEagerSingleton();
// bindings used by external modules
expose(FilterChainResolver.class);
expose(FilterChainManager.class);
}
示例4: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
* @return the default filter chain resolver for this application
*/
@Produces
public FilterChainResolver getFilterChainResolver() {
if (this.filterChainResolver == null) {
final FilterChainManager chainManager = new DefaultFilterChainManager();
chainManager.addFilter("anon", new AnonymousFilter());
chainManager.addFilter("authc", this.configureFormAuthentication());
chainManager.addFilter("perms", new PermissionsAuthorizationFilter());
final PathMatchingFilterChainResolver resolver
= new PathMatchingFilterChainResolver();
chainManager.createChain("/secured/**", "authc");
chainManager.createChain("/index.xhtml", "anon");
resolver.setFilterChainManager(chainManager);
this.filterChainResolver = resolver;
}
return this.filterChainResolver;
}
示例5: init
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Override
public void init() throws Exception {
super.init();
String shiroConfigFile = GojaConfig.getAppSecurityConfig();
final File configFolderFile = GojaConfig.getConfigFolderFile();
shiroConfig = configFolderFile == null ? PropKit.use(shiroConfigFile).getProperties()
: PropKit.use(FileUtils.getFile(configFolderFile, shiroConfigFile)).getProperties();
WebSecurityManager webSecurityManager = initSecurityManager();
FilterChainManager manager = createFilterChainManager();
//Expose the constructed FilterChainManager by first wrapping it in a
// FilterChainResolver implementation. The AbstractShiroFilter implementations
// do not know about FilterChainManagers - only resolvers:
PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
chainResolver.setFilterChainManager(manager);
setSecurityManager(webSecurityManager);
setFilterChainResolver(chainResolver);
}
示例6: FDWebEnvironment
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
public FDWebEnvironment() {
BasicHttpAuthenticationFilter authc = new CorsBasicHttpAuthenticationFilter();
LogoutFilter logout = new LogoutFilter();
logout.setRedirectUrl("http://www.freedomotic.com/");
FilterChainManager fcMan = new DefaultFilterChainManager();
fcMan.addFilter("authc", authc);
fcMan.addFilter("logout", logout);
fcMan.createChain("/auth/logout", "logout");
fcMan.createChain("/v3/**", "authc");
PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
resolver.setFilterChainManager(fcMan);
setFilterChainResolver(resolver);
setWebSecurityManager(RestAPIv3.defaultWebSecurityManager);
}
示例7: MySpringShiroFilter
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
public MySpringShiroFilter(
WebSecurityManager securityManager, PathMatchingFilterChainResolver chainResolver) {
super();
if (securityManager == null){
throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
}
setSecurityManager(securityManager);
if (chainResolver != null){
setFilterChainResolver(chainResolver);
}
}
示例8: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Produces
public FilterChainResolver getFilterChainResolver() {
FilterChainResolver filterChainResolver = null;
if (filterChainResolver == null) {
FormAuthenticationFilter authc = new FormAuthenticationFilter();
AnonymousFilter anon = new AnonymousFilter();
UserFilter user = new UserFilter();
authc.setLoginUrl(WebPages.LOGIN_URL);
user.setLoginUrl(WebPages.LOGIN_URL);
FilterChainManager fcMan = new DefaultFilterChainManager();
fcMan.addFilter("authc", authc);
fcMan.addFilter("anon", anon);
fcMan.addFilter("user", user);
fcMan.createChain("/index.html", "anon");
fcMan.createChain("/css/**", "anon");
fcMan.createChain("/api/**", "anon");
fcMan.createChain(WebPages.LOGIN_URL, "authc");
fcMan.createChain("/**", "user");
PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
resolver.setFilterChainManager(fcMan);
filterChainResolver = resolver;
}
return filterChainResolver;
}
示例9: createInstance
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createInstance(Ini ini) {
FilterChainResolver filterChainResolver = createDefaultInstance();
if (filterChainResolver instanceof PathMatchingFilterChainResolver) {
PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) filterChainResolver;
FilterChainManager manager = resolver.getFilterChainManager();
buildChains(manager, ini);
}
return filterChainResolver;
}
示例10: createDefaultInstance
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
protected FilterChainResolver createDefaultInstance() {
FilterConfig filterConfig = getFilterConfig();
if (filterConfig != null) {
return new PathMatchingFilterChainResolver(filterConfig);
} else {
return new PathMatchingFilterChainResolver();
}
}
示例11: testFilter
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
@Test
public void testFilter() {
AbstractShiroFilter shiroFilter = (AbstractShiroFilter) wac.getBean("shiroFilter");
PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver) shiroFilter
.getFilterChainResolver();
DefaultFilterChainManager fcManager = (DefaultFilterChainManager) resolver.getFilterChainManager();
NamedFilterList chain = fcManager.getChain("/users/**");
assertNotNull(chain);
assertEquals(chain.size(), 2);
Filter[] filters = new Filter[chain.size()];
filters = chain.toArray(filters);
assertTrue(filters[1] instanceof TokenFilter);
}
示例12: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
* @return the default filter chain resolver for this application
*/
@Produces
public FilterChainResolver getFilterChainResolver() {
if (this.filterChainResolver == null) {
final FilterChainManager chainManager = new DefaultFilterChainManager();
chainManager.addFilter("anon", new AnonymousFilter());
chainManager.addFilter("authc", this.configureFormAuthentication());
chainManager.addFilter("perms", new PermissionsAuthorizationFilter());
final PathMatchingFilterChainResolver resolver
= new PathMatchingFilterChainResolver();
chainManager.createChain("/index.xhtml", "anon");
chainManager.createChain("/secured/car/**", "perms[car:access]");
chainManager.createChain("/secured/owner/**", "perms[owner:access]");
chainManager.createChain("/secured/**", "authc");
chainManager.createChain("/api/**", "authcBasic");
resolver.setFilterChainManager(chainManager);
this.filterChainResolver = resolver;
}
return this.filterChainResolver;
}
示例13: getFilter
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; //导入依赖的package包/类
/**
* Returns a {@link Filter} registered to {@link FilterChainManager} with the
* specified name. The default filter instances are typically named of the
* {@link DefaultFilter} enum constant.
*
* @param filterName the filter's name
* @return the {@link Filter} registered with the specified name
*/
protected Filter getFilter(String filterName) {
PathMatchingFilterChainResolver filterChainResolver =
(PathMatchingFilterChainResolver) getFilterChainResolver();
if (filterChainResolver != null) {
FilterChainManager filterChainManager = filterChainResolver.getFilterChainManager();
Map<String, Filter> filters = filterChainManager.getFilters();
return filters.get(filterName);
}
return null;
}