@Test void isHeaderTokenPresent() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); when(request.getHeader(eq(HttpHeaders.AUTHORIZATION))).thenReturn("Bearer 2934728937492374"); assertTrue(jwtBearerTokenAwareFilter.isHeaderTokenPresent(request)); reset(request); when(request.getHeader(eq(HttpHeaders.AUTHORIZATION))).thenReturn("fkddgdg2934728937492374"); assertTrue(jwtBearerTokenAwareFilter.isHeaderTokenPresent(request)); reset(request); when(request.getHeader(eq(HttpHeaders.AUTHORIZATION))).thenReturn("Digest username=\"admin\", realm=\"Upload gallery\", nonce=\"1497178148607:a209e58eea951d9b028a72306e182960\""); assertFalse(jwtBearerTokenAwareFilter.isHeaderTokenPresent(request)); reset(request); when(request.getHeader(eq(HttpHeaders.AUTHORIZATION))).thenReturn("Basic YWRtaW46d3Rxd2VydHk="); assertFalse(jwtBearerTokenAwareFilter.isHeaderTokenPresent(request)); }
boolean isHeaderTokenPresent(HttpServletRequest request) { String token = oidcHelper.getBearerToken(request); return StringUtils.isNotBlank(token) && !token.startsWith(DIGEST_AUTHORIZATION_HEADER_SCHEMA) && !token.startsWith(BASIC_AUTHORIZATION_HEADER_SCHEMA); }
AuthenticationJwtBearerTokenAwareFilter implements Filter { boolean isHeaderTokenPresent(HttpServletRequest request) { String token = oidcHelper.getBearerToken(request); return StringUtils.isNotBlank(token) && !token.startsWith(DIGEST_AUTHORIZATION_HEADER_SCHEMA) && !token.startsWith(BASIC_AUTHORIZATION_HEADER_SCHEMA); } }
AuthenticationJwtBearerTokenAwareFilter implements Filter { boolean isHeaderTokenPresent(HttpServletRequest request) { String token = oidcHelper.getBearerToken(request); return StringUtils.isNotBlank(token) && !token.startsWith(DIGEST_AUTHORIZATION_HEADER_SCHEMA) && !token.startsWith(BASIC_AUTHORIZATION_HEADER_SCHEMA); }  }
AuthenticationJwtBearerTokenAwareFilter implements Filter { boolean isHeaderTokenPresent(HttpServletRequest request) { String token = oidcHelper.getBearerToken(request); return StringUtils.isNotBlank(token) && !token.startsWith(DIGEST_AUTHORIZATION_HEADER_SCHEMA) && !token.startsWith(BASIC_AUTHORIZATION_HEADER_SCHEMA); }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
                         FilterChain filterChain); @Override void destroy(); @Autowired void setoAuthClient(OAuthClient oAuthClient); @Autowired void setOidcHelper(OidcAuthenticationHelper oidcHelper); @Autowired void setAuthorizationStubFilter(AuthorizationStubFilter authorizationStubFilter); @Autowired void setConfig(SecurityConfig config); }
AuthenticationJwtBearerTokenAwareFilter implements Filter { boolean isHeaderTokenPresent(HttpServletRequest request) { String token = oidcHelper.getBearerToken(request); return StringUtils.isNotBlank(token) && !token.startsWith(DIGEST_AUTHORIZATION_HEADER_SCHEMA) && !token.startsWith(BASIC_AUTHORIZATION_HEADER_SCHEMA); }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
                         FilterChain filterChain); @Override void destroy(); @Autowired void setoAuthClient(OAuthClient oAuthClient); @Autowired void setOidcHelper(OidcAuthenticationHelper oidcHelper); @Autowired void setAuthorizationStubFilter(AuthorizationStubFilter authorizationStubFilter); @Autowired void setConfig(SecurityConfig config); static final String DIGEST_AUTHORIZATION_HEADER_SCHEMA; static final String BASIC_AUTHORIZATION_HEADER_SCHEMA; }