本文整理汇总了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");
}
示例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);
}
示例3: getSecurityMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public FilterInvocationSecurityMetadataSource getSecurityMetadataSource() {
return securityMetadataSource;
}
示例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);
}
示例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);
}
示例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 ....");
}
示例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);
}
示例8: setSecurityMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void setSecurityMetadataSource(
FilterInvocationSecurityMetadataSource securityMetadataSource) {
this.securityMetadataSource = securityMetadataSource;
}
示例9: CibetFilterInvocationSecurityMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public CibetFilterInvocationSecurityMetadataSource(
FilterInvocationSecurityMetadataSource s) {
originalMetadataSource = s;
}
示例10: getOriginalMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
/**
* @return the originalMetadataSource
*/
public FilterInvocationSecurityMetadataSource getOriginalMetadataSource() {
return originalMetadataSource;
}
示例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);
}
示例12: getObjectType
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
@Override
public Class<?> getObjectType() {
return FilterInvocationSecurityMetadataSource.class;
}
示例13: getObject
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
@Override
public FilterInvocationSecurityMetadataSource getObject() {
logger.info("###### DefaultFilterInvocationSecurityMetadataSource has changed. ######");
return new DefaultFilterInvocationSecurityMetadataSource(buildRequestMap());
}
示例14: getSecurityMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public FilterInvocationSecurityMetadataSource getSecurityMetadataSource() {
return this.securityMetadataSource;
}
示例15: setSecurityMetadataSource
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; //导入依赖的package包/类
public void setSecurityMetadataSource(FilterInvocationSecurityMetadataSource newSource) {
this.securityMetadataSource = newSource;
}