DisableIdTokenResponseTypeFilter extends OncePerRequestFilter { protected boolean applyPath(String path) { if (paths==null || paths.size()==0 || path == null) { return false; } AntPathMatcher matcher = new AntPathMatcher(); for (String pattern : paths) { if (matcher.isPattern(pattern)) { if (matcher.match(pattern, path)) { return true; } } else { if (pattern.equals(path)) { return true; } } } return false; } DisableIdTokenResponseTypeFilter(boolean active, List<String> paths); boolean isIdTokenDisabled(); void setIdTokenDisabled(boolean disabled); static final String ID_TOKEN; }
@Test public void testApplyPath() { shouldApplyPath("/oauth/token", false); shouldApplyPath("/someotherpath/uaa/oauth/authorize", true); shouldApplyPath("/uaa/oauth/authorize", true); shouldApplyPath("/oauth/authorize", true); shouldApplyPath(null, false); shouldApplyPath("", false); }