本文整理汇总了Java中org.apache.shiro.web.filter.mgt.FilterChainManager类的典型用法代码示例。如果您正苦于以下问题:Java FilterChainManager类的具体用法?Java FilterChainManager怎么用?Java FilterChainManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterChainManager类属于org.apache.shiro.web.filter.mgt包,在下文中一共展示了FilterChainManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createInstance
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:MyShiroFilterFactoryBean.java
示例2: configure
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
@Override
protected void configure() {
super.configure();
bind(ResourceConfig.class).toProvider(ResourceConfigProvider.class).in(Singleton.class);
bind(ServletContainer.class).to(DefaultServletContainer.class);
contribute(FilterChainConfigurator.class, new FilterChainConfigurator() {
@Override
public void configure(FilterChainManager filterChainManager) {
filterChainManager.createChain("/rest/**", "noSessionCreation, authcBasic");
}
});
contribute(JerseyConfigurator.class, new JerseyConfigurator() {
@Override
public void configure(ResourceConfig resourceConfig) {
resourceConfig.packages(RestModule.class.getPackage().getName());
}
});
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:27,代码来源:RestModule.java
示例3: DefaultFilterChainResolver
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
@Inject
public DefaultFilterChainResolver(
Set<FilterChainConfigurator> filterChainConfigurators,
BasicAuthenticationFilter basicAuthenticationFilter) {
super();
FilterChainManager filterChainManager = getFilterChainManager();
filterChainManager.addFilter("authcBasic", basicAuthenticationFilter);
for (FilterChainConfigurator configurator: filterChainConfigurators) {
configurator.configure(filterChainManager);
}
filterChainManager.createChain("/**", "authcBasic");
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:18,代码来源:DefaultFilterChainResolver.java
示例4: createChains
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
protected void createChains(Map<String, String> urls, FilterChainManager manager) {
if (CollectionUtils.isEmpty(urls)) {
if (log.isDebugEnabled()) {
log.debug("No urls to process.");
}
return;
}
if (log.isTraceEnabled()) {
log.trace("Before url processing.");
}
for (Map.Entry<String, String> entry : urls.entrySet()) {
String path = entry.getKey();
String value = entry.getValue();
manager.createChain(path, value);
}
}
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:19,代码来源:IniFilterChainResolverFactory.java
示例5: configureShiroWeb
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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);
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:WebSecurityModule.java
示例6: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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;
}
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:27,代码来源:ShiroConfiguration.java
示例7: getChain
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) {
FilterChainManager filterChainManager = getFilterChainManager();
if (!filterChainManager.hasChains()) {
return null;
}
String requestURI = getPathWithinApplication(request);
List<String> chainNames = new ArrayList<String>();
//the 'chain names' in this implementation are actually path patterns defined by the user. We just use them
//as the chain name for the FilterChainManager's requirements
for (String pathPattern : filterChainManager.getChainNames()) {
// If the path does match, then pass on to the subclass implementation for specific checks:
if (pathMatches(pathPattern, requestURI)) {
chainNames.add(pathPattern);
}
}
if(chainNames.size() == 0) {
return null;
}
return customDefaultFilterChainManager.proxy(originalChain, chainNames);
}
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:26,代码来源:CustomPathMatchingFilterChainResolver.java
示例8: init
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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);
}
开发者ID:GojaFramework,项目名称:goja,代码行数:23,代码来源:GojaShiroFilter.java
示例9: createFilterChainManager
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
protected FilterChainManager createFilterChainManager() {
final DefaultFilterChainManager manager = new DefaultFilterChainManager();
Map<String, Filter> defaultFilters = manager.getFilters();
//apply global settings if necessary:
for (Filter filter : defaultFilters.values()) {
applyGlobalPropertiesIfNecessary(filter);
}
if (shiroConfig != null && !shiroConfig.isEmpty()) {
for (Object urlKey : shiroConfig.keySet()) {
String url = String.valueOf(urlKey);
if (org.apache.commons.lang3.StringUtils.equals("login.url", url)
|| org.apache.commons.lang3.StringUtils.equals("success.url", url)
|| org.apache.commons.lang3.StringUtils.equals("unauthorized.url", url)
|| org.apache.commons.lang3.StringUtils.equals("session.expired", url)
) {
continue;
}
// { "authc", "roles[admin,user]", "perms[file:edit]" }
manager.createChain(url, MoreObjects.firstNonNull(shiroConfig.getProperty(url), "anon"));
}
}
return manager;
}
开发者ID:GojaFramework,项目名称:goja,代码行数:26,代码来源:GojaShiroFilter.java
示例10: FDWebEnvironment
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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);
}
开发者ID:freedomotic,项目名称:freedomotic,代码行数:18,代码来源:FDWebEnvironment.java
示例11: getChain
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
@Override
public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) {
FilterChainManager filterChainManager = getFilterChainManager();
if (!filterChainManager.hasChains()) {
return null;
}
String requestURI = getPathWithinApplication(request);
List<String> chainNames = new ArrayList<String>();
for (String pathPattern : filterChainManager.getChainNames()) {
//校验满足所有规则的URL
// if (pathMatches(pathPattern, requestURI)) {
// chainNames.add(pathPattern);
// }
//校验第一个满足规则的URL
if (pathMatches(pathPattern, requestURI)) {
log.debug("Matched path pattern [" + pathPattern + "] for requestURI [" + requestURI + "]. " +
"Utilizing corresponding filter chain...");
return filterChainManager.proxy(originalChain, pathPattern);
}
}
if(chainNames.size() == 0) {
return null;
}
return customDefaultFilterChainManager.proxy(originalChain, chainNames);
}
开发者ID:simbest,项目名称:simbest-cores,代码行数:28,代码来源:CustomPathMatchingFilterChainResolver.java
示例12: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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;
}
开发者ID:nebrass,项目名称:pairing-shiro-javaee7,代码行数:29,代码来源:ShiroConfiguration.java
示例13: createInstance
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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;
}
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:10,代码来源:IniFilterChainResolverFactory.java
示例14: buildChains
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
protected void buildChains(FilterChainManager manager, Ini ini) {
//filters section:
Ini.Section section = ini.getSection(FILTERS);
if (!CollectionUtils.isEmpty(section)) {
String msg = "The [{}] section has been deprecated and will be removed in a future release! Please " +
"move all object configuration (filters and all other objects) to the [{}] section.";
log.warn(msg, FILTERS, IniSecurityManagerFactory.MAIN_SECTION_NAME);
}
Map<String, Object> defaults = new LinkedHashMap<String, Object>();
Map<String, Filter> defaultFilters = manager.getFilters();
//now let's see if there are any object defaults in addition to the filters
//these can be used to configure the filters:
//create a Map of objects to use as the defaults:
if (!CollectionUtils.isEmpty(defaultFilters)) {
defaults.putAll(defaultFilters);
}
//User-provided objects must come _after_ the default filters - to allow the user-provided
//ones to override the default filters if necessary.
if (!CollectionUtils.isEmpty(this.defaultBeans)) {
defaults.putAll(this.defaultBeans);
}
Map<String, Filter> filters = getFilters(section, defaults);
//add the filters to the manager:
registerFilters(filters, manager);
//urls section:
section = ini.getSection(URLS);
createChains(section, manager);
}
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:36,代码来源:IniFilterChainResolverFactory.java
示例15: registerFilters
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
protected void registerFilters(Map<String, Filter> filters, FilterChainManager manager) {
if (!CollectionUtils.isEmpty(filters)) {
boolean init = getFilterConfig() != null; //only call filter.init if there is a FilterConfig available
for (Map.Entry<String, Filter> entry : filters.entrySet()) {
String name = entry.getKey();
Filter filter = entry.getValue();
manager.addFilter(name, filter, init);
}
}
}
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:11,代码来源:IniFilterChainResolverFactory.java
示例16: getFilterChainResolver
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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;
}
开发者ID:arthurgregorio,项目名称:exemplos,代码行数:32,代码来源:ShiroConfiguration.java
示例17: getFilter
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的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;
}
开发者ID:panifex,项目名称:panifex-platform,代码行数:22,代码来源:SecurityFilterImpl.java
示例18: expectGettingFilterWithName
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
private void expectGettingFilterWithName(Filter filter, String filterName) {
// expect getting filterChainManager
FilterChainManager filterChainManagerMock = createMock(FilterChainManager.class);
expect(filterChainResolverMock.getFilterChainManager()).andReturn(filterChainManagerMock);
// expect getting form authentication filters
Map<String, Filter> filters = new HashMap<>();
filters.put(DefaultFilter.authc.toString(), filter);
expect(filterChainManagerMock.getFilters()).andReturn(filters);
}
开发者ID:panifex,项目名称:panifex-platform,代码行数:11,代码来源:SecurityFilterImplTest.java
示例19: getFilterChainManager
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
protected FilterChainManager getFilterChainManager() {
return filterChainManager;
}
开发者ID:panifex,项目名称:panifex-platform,代码行数:4,代码来源:ModularWebEnvironment.java
示例20: configure
import org.apache.shiro.web.filter.mgt.FilterChainManager; //导入依赖的package包/类
void configure(FilterChainManager filterChainManager);
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:2,代码来源:FilterChainConfigurator.java
注:本文中的org.apache.shiro.web.filter.mgt.FilterChainManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论