@Test void shouldSkip(){ AuthenticationRealmAwareFilter authenticationRealmAwareFilter = getFilter(); authenticationRealmAwareFilter.setFilterApplyUrlRegex("\\/users\\/.*"); authenticationRealmAwareFilter.setFilterApplyUrlList(Arrays.asList("/orders/id", "/orders/get")); authenticationRealmAwareFilter.setFilterIgnoreUrls(Collections.emptyList()); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/users/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/orders/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/contacts/id")), is(true)); authenticationRealmAwareFilter.setFilterApplyUrlRegex("\\/users\\/.*"); authenticationRealmAwareFilter.setFilterApplyUrlList(Collections.singletonList("/orders/*")); authenticationRealmAwareFilter.setFilterIgnoreUrls(Collections.singletonList("/users/id")); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/users/id")), is(true)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/orders/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/contacts/id")), is(true)); authenticationRealmAwareFilter.setFilterApplyUrlList(Collections.singletonList("/orders/*")); authenticationRealmAwareFilter.setFilterIgnoreUrls(Collections.emptyList()); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/users/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/orders/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/contacts/id")), is(true)); authenticationRealmAwareFilter.setFilterApplyUrlRegex(""); authenticationRealmAwareFilter.setFilterApplyUrlList(Arrays.asList("/orders/*", "/users/*")); authenticationRealmAwareFilter.setFilterIgnoreUrls(Collections.emptyList()); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/users/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/orders/id")), is(false)); assertThat(authenticationRealmAwareFilter.shouldSkip(MockHttpRequest.mockGetUri("/contacts/id")), is(true)); }
boolean shouldSkip(ServletRequest request) { return shouldSkip(new ServletServerHttpRequest((HttpServletRequest) request)); }
AuthenticationRealmAwareFilter implements Filter { boolean shouldSkip(ServletRequest request) { return shouldSkip(new ServletServerHttpRequest((HttpServletRequest) request)); } }
AuthenticationRealmAwareFilter implements Filter { boolean shouldSkip(ServletRequest request) { return shouldSkip(new ServletServerHttpRequest((HttpServletRequest) request)); } @Autowired  AuthenticationRealmAwareFilter(OidcAuthenticationHelper oidcAuthenticationHelper); }
AuthenticationRealmAwareFilter implements Filter { boolean shouldSkip(ServletRequest request) { return shouldSkip(new ServletServerHttpRequest((HttpServletRequest) request)); } @Autowired  AuthenticationRealmAwareFilter(OidcAuthenticationHelper oidcAuthenticationHelper); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); @Override void destroy(); @Value("${security.oidc.AuthenticationRealmAwareFilter.enable:true}") void setEnableFilter(boolean enableFilter); @Value("${security.oidc.AuthenticationRealmAwareFilter.realmUrlPattern:}") void setRealmUrlPattern(String realmUrlPattern); @Value("${security.oidc.AuthenticationRealmAwareFilter.filterApplyUrlRegex:}") void setFilterApplyUrlRegex(String filterApplyUrlRegex); @Value("${security.oidc.AuthenticationRealmAwareFilter.realmParamName:realm}") void setRealmParamName(String realmParamName); @Value("${security.oidc.AuthenticationRealmAwareFilter.isRealmMandatory:true}") void setRealmMandatory(boolean realmMandatory); @Value("#{'${security.oidc.AuthenticationRealmAwareFilter.filterApplyUrlList:}'.split(',')}") void setFilterApplyUrlList(List<String> filterApplyUrlList); @Value("#{'${security.oidc.AuthenticationRealmAwareFilter.filterIgnoreUrlList:}'.split(',')}") void setFilterIgnoreUrls(List<String> filterIgnoreUrlList); @Override String toString(); }
AuthenticationRealmAwareFilter implements Filter { boolean shouldSkip(ServletRequest request) { return shouldSkip(new ServletServerHttpRequest((HttpServletRequest) request)); } @Autowired  AuthenticationRealmAwareFilter(OidcAuthenticationHelper oidcAuthenticationHelper); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); @Override void destroy(); @Value("${security.oidc.AuthenticationRealmAwareFilter.enable:true}") void setEnableFilter(boolean enableFilter); @Value("${security.oidc.AuthenticationRealmAwareFilter.realmUrlPattern:}") void setRealmUrlPattern(String realmUrlPattern); @Value("${security.oidc.AuthenticationRealmAwareFilter.filterApplyUrlRegex:}") void setFilterApplyUrlRegex(String filterApplyUrlRegex); @Value("${security.oidc.AuthenticationRealmAwareFilter.realmParamName:realm}") void setRealmParamName(String realmParamName); @Value("${security.oidc.AuthenticationRealmAwareFilter.isRealmMandatory:true}") void setRealmMandatory(boolean realmMandatory); @Value("#{'${security.oidc.AuthenticationRealmAwareFilter.filterApplyUrlList:}'.split(',')}") void setFilterApplyUrlList(List<String> filterApplyUrlList); @Value("#{'${security.oidc.AuthenticationRealmAwareFilter.filterIgnoreUrlList:}'.split(',')}") void setFilterIgnoreUrls(List<String> filterIgnoreUrlList); @Override String toString(); static final String BASE_REALM_REGEX; }