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


Java FilterInvocationSecurityMetadataSource类代码示例

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


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

示例1: initInterceptor

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
protected void initInterceptor(FilterSecurityInterceptor interceptor) {
   FilterInvocationSecurityMetadataSource metaDatasource = interceptor.getSecurityMetadataSource();
   if (metaDatasource == null) {
      String msg = "Configuration error: FilterSecurityInterceptor bean "
            + "has not set an instance SecurityMetadataSource";
      log.error(msg);
      throw new RuntimeException(msg);
   }
   if (metaDatasource instanceof CibetFilterInvocationSecurityMetadataSource) {
      return;
   }
   CibetFilterInvocationSecurityMetadataSource cibetDel = new CibetFilterInvocationSecurityMetadataSource(
         metaDatasource);
   interceptor.setSecurityMetadataSource(cibetDel);
   log.debug("replace existing " + metaDatasource.getClass().getName()
         + " against CibetFilterInvocationSecurityMetadataSource");
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:18,代码来源:SpringSecurityActuator.java

示例2: execute

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void execute(FilterSecurityInterceptor filterSecurityInterceptor,
        Map<String, String> resourceMap) {
    Assert.notNull(filterSecurityInterceptor);
    Assert.notNull(resourceMap);

    logger.info("refresh url resource");

    LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = null;
    requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();

    for (Map.Entry<String, String> entry : resourceMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        requestMap.put(new AntPathRequestMatcher(key),
                SecurityConfig.createListFromCommaDelimitedString(value));
    }

    FilterInvocationSecurityMetadataSource source = new DefaultFilterInvocationSecurityMetadataSource(
            requestMap);
    filterSecurityInterceptor.setSecurityMetadataSource(source);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:22,代码来源:UrlResourcePopulator.java

示例3: getSecurityMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public FilterInvocationSecurityMetadataSource getSecurityMetadataSource() {
	return securityMetadataSource;
}
 
开发者ID:wanliyang10010,项目名称:Shop,代码行数:4,代码来源:MyFilterSecurityInterceptor.java

示例4: MockedSecurityInterceptor

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public MockedSecurityInterceptor() {
    this.setAuthenticationManager(authentication -> null);

    AccessDecisionManager accessDecisionManager = mock(AccessDecisionManager.class);
    doReturn(true).when(accessDecisionManager).supports(any(Class.class));
    this.setAccessDecisionManager(accessDecisionManager);

    FilterInvocationSecurityMetadataSource filterInvocationSecurityMetadataSource =
        mock(FilterInvocationSecurityMetadataSource.class);
    doReturn(true).when(filterInvocationSecurityMetadataSource).supports(any(Class.class));
    this.setSecurityMetadataSource(filterInvocationSecurityMetadataSource);
}
 
开发者ID:trustedanalytics,项目名称:user-management,代码行数:13,代码来源:MockedSecurityInterceptor.java

示例5: addSecureChannel

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
private void addSecureChannel(List<Filter> filters, Protocol protocol) {
    ChannelProcessingFilter channelProcessingFilter = new ChannelProcessingFilter();
    channelProcessingFilter.setChannelDecisionManager(channelDecisionManager);

    RequestMatcher anyRequest = AnyRequestMatcher.INSTANCE;

    LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
    Collection<ConfigAttribute> configAtts = new ArrayList<>();

    switch (protocol) {
        case HTTP:
            configAtts.add(new SecurityConfig("ANY_CHANNEL"));
            break;
        case HTTPS:
            configAtts.add(new SecurityConfig("REQUIRES_SECURE_CHANNEL"));
            break;
        default:
    }

    requestMap.put(anyRequest, configAtts);
    FilterInvocationSecurityMetadataSource securityMetadataSource = new DefaultFilterInvocationSecurityMetadataSource(requestMap);
    channelProcessingFilter.setSecurityMetadataSource(securityMetadataSource);

    filters.add(channelProcessingFilter);
}
 
开发者ID:motech,项目名称:motech,代码行数:26,代码来源:SecurityRuleBuilder.java

示例6: refresh

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
/**
 * Refresh.
 */
public void refresh() {
	ApplicationContext ctx = WebApplicationContextUtils
			.getRequiredWebApplicationContext(servletContext);
	FilterInvocationSecurityMetadataSource fisms = (FilterInvocationSecurityMetadataSource) ctx
			.getBean("securityMetadataSource");
	// Get  FilterSecurityInterceptor
	FilterSecurityInterceptor fsi = (FilterSecurityInterceptor) ctx
			.getBean("filterSecurityInterceptor");
	// Set new SecurityMetadataSource to FilterSecurityInterceptor
	fsi.setSecurityMetadataSource(fisms);
	log.info(" SecurityMetadataSource updating ....");
}
 
开发者ID:rockagen,项目名称:gnext,代码行数:16,代码来源:BasicRefreshMetadataSource.java

示例7: refresh

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void refresh() {
    if ((filterSecurityInterceptor == null) || (urlSourceFetcher == null)) {
        logger.info(
                "filterSecurityInterceptor : {}, urlSourceFetcher : {}",
                filterSecurityInterceptor, urlSourceFetcher);

        return;
    }

    logger.info("execute refresh");

    Map<String, String> resourceMap = urlSourceFetcher.getSource(null);

    LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = null;
    requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>();

    for (Map.Entry<String, String> entry : resourceMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        requestMap.put(new AntPathRequestMatcher(key),
                SecurityConfig.createListFromCommaDelimitedString(value));
    }

    FilterInvocationSecurityMetadataSource source = new DefaultFilterInvocationSecurityMetadataSource(
            requestMap);
    filterSecurityInterceptor.setSecurityMetadataSource(source);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:28,代码来源:UrlSourceBuilder.java

示例8: setSecurityMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void setSecurityMetadataSource(
		FilterInvocationSecurityMetadataSource securityMetadataSource) {
	this.securityMetadataSource = securityMetadataSource;
}
 
开发者ID:wanliyang10010,项目名称:Shop,代码行数:5,代码来源:MyFilterSecurityInterceptor.java

示例9: CibetFilterInvocationSecurityMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public CibetFilterInvocationSecurityMetadataSource(
      FilterInvocationSecurityMetadataSource s) {
   originalMetadataSource = s;
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:5,代码来源:CibetFilterInvocationSecurityMetadataSource.java

示例10: getOriginalMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
/**
 * @return the originalMetadataSource
 */
public FilterInvocationSecurityMetadataSource getOriginalMetadataSource() {
   return originalMetadataSource;
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:7,代码来源:CibetFilterInvocationSecurityMetadataSource.java

示例11: addFilterSecurityInterceptor

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
private void addFilterSecurityInterceptor(List<Filter> filters, MotechURLSecurityRule securityRule) {
    Map<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();

    List<AccessDecisionVoter> voters = new ArrayList<>();
    Collection<ConfigAttribute> configAtts = new ArrayList<>();

    if (CollectionUtils.isEmpty(securityRule.getPermissionAccess()) && CollectionUtils.isEmpty(securityRule.getUserAccess())) {
        configAtts.add(new SecurityConfig("IS_AUTHENTICATED_FULLY"));
        AuthenticatedVoter authVoter = new AuthenticatedVoter();
        voters.add(authVoter);
    } else {
        if (!CollectionUtils.isEmpty(securityRule.getPermissionAccess())) {
            for (String permission : securityRule.getPermissionAccess()) {
                configAtts.add(new SecurityConfig(permission));
            }
        }
        if (!CollectionUtils.isEmpty(securityRule.getUserAccess())) {
            for (String userAccess : securityRule.getUserAccess()) {
                configAtts.add(new SecurityConfig(SecurityConfigConstants.USER_ACCESS_PREFIX + userAccess));
            }
        }
    }

    buildRequestMap(requestMap, configAtts, securityRule);

    FilterInvocationSecurityMetadataSource metadataSource = new DefaultFilterInvocationSecurityMetadataSource((LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>) requestMap);

    FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
    interceptor.setSecurityMetadataSource(metadataSource);

    RoleVoter roleVoter = new RoleVoter();

    roleVoter.setRolePrefix(SecurityConfigConstants.ROLE_ACCESS_PREFIX);
    voters.add(roleVoter);

    voters.add(new MotechAccessVoter());

    AccessDecisionManager decisionManager = new AffirmativeBased(voters);

    interceptor.setAccessDecisionManager(decisionManager);
    interceptor.setAuthenticationManager(authenticationManager);

    filters.add(interceptor);
}
 
开发者ID:motech,项目名称:motech,代码行数:45,代码来源:SecurityRuleBuilder.java

示例12: getObjectType

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
@Override
public Class<?> getObjectType() {
	return FilterInvocationSecurityMetadataSource.class;
}
 
开发者ID:rockagen,项目名称:gnext,代码行数:5,代码来源:JdbcFilterInvocationSecurityMetadataSourceFactoryBean.java

示例13: getObject

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
@Override
public FilterInvocationSecurityMetadataSource getObject() {
	logger.info("###### DefaultFilterInvocationSecurityMetadataSource has changed. ######");
	return new DefaultFilterInvocationSecurityMetadataSource(buildRequestMap());

}
 
开发者ID:rockagen,项目名称:gnext,代码行数:7,代码来源:JdbcFilterInvocationSecurityMetadataSourceFactoryBean.java

示例14: getSecurityMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public FilterInvocationSecurityMetadataSource getSecurityMetadataSource() {
	return this.securityMetadataSource;
}
 
开发者ID:xiaolongzuo,项目名称:zxl,代码行数:4,代码来源:ResourceSecurityFilter.java

示例15: setSecurityMetadataSource

import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void setSecurityMetadataSource(FilterInvocationSecurityMetadataSource newSource) {
	this.securityMetadataSource = newSource;
}
 
开发者ID:xiaolongzuo,项目名称:zxl,代码行数:4,代码来源:ResourceSecurityFilter.java


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