本文整理汇总了Java中org.springframework.security.web.SecurityFilterChain类的典型用法代码示例。如果您正苦于以下问题:Java SecurityFilterChain类的具体用法?Java SecurityFilterChain怎么用?Java SecurityFilterChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecurityFilterChain类属于org.springframework.security.web包,在下文中一共展示了SecurityFilterChain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"),
samlLogoutFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
metadataDisplayFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSOHoK/**"),
samlWebSSOHoKProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
samlLogoutProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"),
samlIDPDiscovery()));
return new FilterChainProxy(chains);
}
示例2: springSecurityFilterChain
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Bean(name = "springSecurityFilterChain")
public FilterChainProxy springSecurityFilterChain() throws ServletException, Exception {
final List<SecurityFilterChain> listOfFilterChains = new ArrayList<SecurityFilterChain>();
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/cors")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/dump")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/validatorUrl")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-resources")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/ui")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/security")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/v2/api-docs")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-ui.html")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/webjars/**")));
// no filters
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/webjars/**")));// no filters
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/*"), securityContextPersistenceFilterWithASCFalse(),
usernamePasswordAuthenticationFilter(), sessionManagementFilter(), exceptionTranslationFilter(), filterSecurityInterceptor()));
final FilterChainProxy filterChainProxy = new FilterChainProxy(listOfFilterChains);
return filterChainProxy;
}
示例3: springSecurityFilterChain
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Bean(name = "springSecurityFilterChain")
public FilterChainProxy springSecurityFilterChain() throws ServletException, Exception {
final List<SecurityFilterChain> listOfFilterChains = new ArrayList<SecurityFilterChain>();
// listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/login"), new NoSecurityFilter()));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/validatorUrl")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-resources")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/ui")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/security")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/v2/api-docs")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-ui.html")));
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/webjars/**")));
// no filters
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/webjars/**")));// no filters
listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/**"), securityContextPersistenceFilterWithASCFalse(),
exceptionTranslationFilter(), filterSecurityInterceptor()));
final FilterChainProxy filterChainProxy = new FilterChainProxy(listOfFilterChains);
return filterChainProxy;
}
示例4: Can_modify_a_filter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Test
public void Can_modify_a_filter() {
@SuppressWarnings("unchecked")
final Modifier<FilterTwo> modifier = mock(Modifier.class);
final SecurityFilterChain chain = mock(SecurityFilterChain.class);
final FilterTwo filter1 = mock(FilterTwo.class);
// Given
given(chain.getFilters()).willReturn(asList(mock(FilterOne.class), filter1, mock(FilterThree.class)));
// When
configurer.modifyLink(chain, FilterTwo.class, modifier);
// Then
verify(modifier).modify(filter1);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:19,代码来源:SecurityFilterChainModifierTest.java
示例5: Can_add_a_filter_before_another
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Test
public void Can_add_a_filter_before_another() {
final FilterTwo filterTwo = mock(FilterTwo.class);
final FilterOne filterOne = mock(FilterOne.class);
final FilterThree filterThree = mock(FilterThree.class);
final FilterFour filterFour = mock(FilterFour.class);
final SecurityFilterChain chain = mock(SecurityFilterChain.class);
final List<Filter> filters = new ArrayList<>(asList(filterOne, filterThree, filterFour, filterThree));
// Given
given(chain.getFilters()).willReturn(filters);
// When
configurer.addBefore(chain, FilterThree.class, filterTwo);
// Then
assertThat(filters, contains(filterOne, filterTwo, filterThree, filterFour, filterThree));
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:22,代码来源:SecurityFilterChainModifierTest.java
示例6: Can_not_add_a_filter_before_a_filter_that_does_not_exist
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Test
public void Can_not_add_a_filter_before_a_filter_that_does_not_exist() {
final FilterTwo filterTwo = mock(FilterTwo.class);
final FilterOne filterOne = mock(FilterOne.class);
final FilterThree filterThree = mock(FilterThree.class);
final FilterFour filterFour = mock(FilterFour.class);
final SecurityFilterChain chain = mock(SecurityFilterChain.class);
final List<Filter> filters = new ArrayList<>(asList(filterOne, filterFour));
// Given
given(chain.getFilters()).willReturn(filters);
// When
configurer.addBefore(chain, FilterThree.class, filterTwo);
// Then
assertThat(filters, contains(filterOne, filterFour));
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:22,代码来源:SecurityFilterChainModifierTest.java
示例7: Can_weave_a_filter_chain_proxy
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Test
public void Can_weave_a_filter_chain_proxy() {
final SecurityFilterChain chain1 = mock(SecurityFilterChain.class);
final SecurityFilterChain chain2 = mock(SecurityFilterChain.class);
final SecurityFilterChain chain3 = mock(SecurityFilterChain.class);
// Given
given(filterChainProxy.getFilterChains()).willReturn(asList(chain1, chain2, chain3));
// When
proxyWeaver.weave();
// Then
verify(chainWeaver).weave(chain1);
verify(chainWeaver).weave(chain2);
verify(chainWeaver).weave(chain3);
verifyNoMoreInteractions(chainWeaver);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:20,代码来源:FilterChainProxyWeaverTest.java
示例8: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
/**
* SAML Filter.
* @return SAMLFilter
* @throws Exception Exception
*/
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"),
samlLogoutFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSOHoK/**"),
samlWebSSOHoKProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
samlLogoutProcessingFilter()));
return new FilterChainProxy(chains);
}
示例9: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
private FilterChainProxy samlFilter(SAMLEntryPoint samlEntryPoint, SAMLContextProvider contextProvider) {
List<SecurityFilterChain> chains = new ArrayList<>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
samlEntryPoint));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
new MetadataDisplayFilter()));
try {
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter(samlAuthenticationProvider, contextProvider, samlProcessor)));
} catch (Exception e) {
e.printStackTrace();
}
SAMLDiscovery samlDiscovery = new SAMLDiscovery();
samlDiscovery.setMetadata(cachingMetadataManager);
samlDiscovery.setContextProvider(contextProvider);
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"),
samlDiscovery));
return new FilterChainProxy(chains);
}
示例10: updateSecurityChain
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
/**
* Updates security chain with given {@link org.motechproject.security.domain.MotechURLSecurityRule}
*
* @param securityRules list that contains new security rules
*/
private void updateSecurityChain(List<MotechURLSecurityRule> securityRules) {
LOGGER.debug("Updating security chain");
// sort rules by priority descending
TreeSet<MotechURLSecurityRule> sortedRules = new TreeSet<>(new SecurityRuleComparator());
sortedRules.addAll(securityRules);
List<SecurityFilterChain> newFilterChains = new ArrayList<>();
for (MotechURLSecurityRule securityRule : sortedRules) {
if (securityRule.isActive() && !securityRule.isDeleted()) {
LOGGER.debug("Creating SecurityFilterChain for: {}", securityRule.getPattern());
for (HTTPMethod method : securityRule.getMethodsRequired()) {
newFilterChains.add(securityRuleBuilder.buildSecurityChain(securityRule, method));
}
LOGGER.debug("Created SecurityFilterChain for: {}", securityRule.getPattern());
}
}
proxy = new FilterChainProxy(newFilterChains);
LOGGER.debug("Updated security chain.");
}
示例11: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
/**
* Define the security filter chain in order to support SSO Auth by using SAML 2.0
*
* @return Filter chain proxy
* @throws Exception
*/
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"), samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"), samlLogoutFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
metadataDisplayFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSOHoK/**"),
samlWebSSOHoKProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
samlLogoutProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"), samlIDPDiscovery()));
return new FilterChainProxy(chains);
}
示例12: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
/**
* Define the security filter chain in order to support SSO Auth by using SAML 2.0
*
* @return Filter chain proxy
* @throws Exception
*/
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
new TargetStoringFilter(),
samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"),
new TargetStoringFilter(),
samlLogoutFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
metadataDisplayFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
samlLogoutProcessingFilter()));
return new FilterChainProxy(chains);
}
示例13: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
/**
* Define the security filter chain in order to support SSO Auth by using SAML 2.0
*
* @return Filter chain proxy
* @throws Exception
*/
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"),
samlLogoutFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
metadataDisplayFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSOHoK/**"),
samlWebSSOHoKProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
samlLogoutProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"),
samlIDPDiscovery()));
return new FilterChainProxy(chains);
}
示例14: postProcessAfterInitialization
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof FilterChainProxy) {
FilterChainProxy chains = (FilterChainProxy) bean;
for (SecurityFilterChain chain : chains.getFilterChains()) {
for (Filter filter : chain.getFilters()) {
if (filter instanceof OAuth2ClientAuthenticationProcessingFilter) {
OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationProcessingFilter =
(OAuth2ClientAuthenticationProcessingFilter) filter;
oAuth2ClientAuthenticationProcessingFilter
.setAuthenticationSuccessHandler(new OAuth2AuthenticationSuccessHandler());
}
}
}
}
return bean;
}
示例15: samlFilter
import org.springframework.security.web.SecurityFilterChain; //导入依赖的package包/类
@Bean
public FilterChainProxy samlFilter() throws Exception {
List<SecurityFilterChain> chains = new ArrayList<>();
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
samlEntryPoint()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
metadataDisplayFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
samlWebSSOProcessingFilter()));
chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"),
samlIDPDiscovery()));
return new FilterChainProxy(chains);
}