public FacebookLoginFilter( @Value("${facebook.filter.callback-uri}") String callbackUri, @Value("${facebook.filter.api-base-uri}")String apiBaseUri) { super(new OrRequestMatcher( new AntPathRequestMatcher(callbackUri), new AntPathRequestMatcher(apiBaseUri) )); this.localMatcher = new AntPathRequestMatcher(apiBaseUri); setAuthenticationManager(new NoopAuthenticationManager()); }
public OpenIdConnectFilter( @Value("${openid.callback-uri}") String callbackUri, @Value("${openid.api-base-uri}") String apiBaseUri) { super(new OrRequestMatcher( new AntPathRequestMatcher(callbackUri), new AntPathRequestMatcher(apiBaseUri))); this.localMatcher = new AntPathRequestMatcher(apiBaseUri); setAuthenticationManager(new NoopAuthenticationManager()); }
private boolean skipPathRequest(HttpServletRequest request, List<String> pathsToSkip ) { Assert.notNull(pathsToSkip, "pathsToSkip is null!"); List<RequestMatcher> m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)).collect(Collectors.toList()); OrRequestMatcher matchers = new OrRequestMatcher(m); return matchers.matches(request); }
@SuppressWarnings("deprecation") public SkipPathRequestMatcher(List<String> pathsToSkip, String processingPath) { Assert.notNull(pathsToSkip); List<RequestMatcher> m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)).collect(Collectors.toList()); matchers = new OrRequestMatcher(m); processingMatcher = new AntPathRequestMatcher(processingPath); }
public SkipPathRequestMatcher(List<String> pathsToSkip, String processingPath) { Assert.notNull(pathsToSkip); List<RequestMatcher> m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)) .collect(Collectors.toList()); matchers = new OrRequestMatcher(m); processingMatcher = new AntPathRequestMatcher(processingPath); }
public CsrfCookieGeneratorFilter(final String... ignoredPatterns) { if (ignoredPatterns.length > 0) { this.ignoredMatcher = new OrRequestMatcher(Arrays.stream(ignoredPatterns) .map(AntPathRequestMatcher::new) .collect(toList())); } else { this.ignoredMatcher = new NegatedRequestMatcher(AnyRequestMatcher.INSTANCE); } }
private RequestMatcher createDelegate() { ServerProperties server = this.contextResolver.getApplicationContext() .getBean(ServerProperties.class); List<RequestMatcher> matchers = new ArrayList<RequestMatcher>(); EndpointHandlerMapping endpointHandlerMapping = getRequiredEndpointHandlerMapping(); for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) { matchers.add(new AntPathRequestMatcher(server.getPath(path))); } return (matchers.isEmpty() ? MATCH_NONE : new OrRequestMatcher(matchers)); }
private RequestMatcher createDelegate() { ServerProperties server = ManagementWebSecurityConfigurerAdapter.this.server; List<RequestMatcher> matchers = new ArrayList<RequestMatcher>(); EndpointHandlerMapping endpointHandlerMapping = ManagementWebSecurityConfigurerAdapter.this .getRequiredEndpointHandlerMapping(); for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) { matchers.add(new AntPathRequestMatcher(server.getPath(path))); } return (matchers.isEmpty() ? AnyRequestMatcher.INSTANCE : new OrRequestMatcher(matchers)); }
@SuppressWarnings("ProhibitedExceptionDeclared") @Override protected void configure(final HttpSecurity http) throws Exception { final AuthenticationSuccessHandler loginSuccessHandler = new LoginSuccessHandler(FindRole.CONFIG.toString(), FindController.CONFIG_PATH, "/p/"); final HttpSessionRequestCache requestCache = new HttpSessionRequestCache(); requestCache.setRequestMatcher(new OrRequestMatcher( new AntPathRequestMatcher("/p/**"), new AntPathRequestMatcher(FindController.CONFIG_PATH) )); http.regexMatcher("/p/.*|/config/.*|/authenticate|/logout") .authorizeRequests() .antMatchers("/p/**").hasRole(FindRole.ADMIN.name()) .antMatchers(FindController.CONFIG_PATH).hasRole(FindRole.CONFIG.name()) .and() .requestCache() .requestCache(requestCache) .and() .formLogin() .loginPage(FindController.DEFAULT_LOGIN_PAGE) .loginProcessingUrl("/authenticate") .successHandler(loginSuccessHandler) .failureUrl(FindController.DEFAULT_LOGIN_PAGE + "?error=auth") .and() .logout() .logoutSuccessHandler(new HodLogoutSuccessHandler(new HodTokenLogoutSuccessHandler(SsoController.SSO_LOGOUT_PAGE, tokenRepository), FindController.APP_PATH)) .and() .csrf() .disable(); }
private IgnoredRequestMatcher() { ConfigList c = Config.getConfig().getList("security.ignored"); List<RequestMatcher> list = new ArrayList<>(c.size()); for (ConfigValue configValue : c) { list.add(new AntPathRequestMatcher((String) configValue.unwrapped())); } orMatcher = new OrRequestMatcher(list); }
private boolean skipPathRequest(HttpServletRequest request, List<String> pathsToSkip ) { Assert.notNull(pathsToSkip, "path cannot be null."); List<RequestMatcher> m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)).collect(Collectors.toList()); OrRequestMatcher matchers = new OrRequestMatcher(m); return matchers.matches(request); }
public SkipPathRequestMatcher(List<String> pathsToSkip, String processingPath) { Assert.notNull(pathsToSkip); List<RequestMatcher> m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)).collect(Collectors.toList()); matchers = new OrRequestMatcher(m); processingMatcher = new AntPathRequestMatcher(processingPath); }
/** * Returns an {@link OrRequestMatcher} that contains all the different URLs configured throughout the Service * Provider configuration. * * @return */ public RequestMatcher getRequestMatcher() { return new OrRequestMatcher(requestMatchers(defaultFailureURL, ssoProcessingURL, ssoHoKProcessingURL, discoveryProcessingURL, idpSelectionPageURL, ssoLoginURL, metadataURL, defaultTargetURL, logoutURL, singleLogoutURL)); }