@Test void isSuccessfulSetupRealmFromUri() { MockHttpServletRequest request = new MockHttpServletRequest(); authenticationRealmAwareFilter.setRealmUrlPattern("/security/{realm}/users"); request.setRequestURI("/index.html"); assertThat(authenticationRealmAwareFilter.isSuccessfulSetupRealmFromUri(request), is(false)); request.setRequestURI("/security/realm/users"); assertThat(authenticationRealmAwareFilter.isSuccessfulSetupRealmFromUri(request), is(true)); request.setRequestURI("/security/users"); assertThat(authenticationRealmAwareFilter.isSuccessfulSetupRealmFromUri(request), is(false)); }
boolean isSuccessfulSetupRealmFromUri(HttpServletRequest request) { String url = request.getRequestURI(); String realm = retrieveRealmFromUrl(url); if (StringUtils.isBlank(realm)) return false; logger.info("realm: {} was retrieved from url: {}", realm, url); oidcAuthenticationHelper.setRealmForCurrentRequest(realm); return true; }
AuthenticationRealmAwareFilter implements Filter { boolean isSuccessfulSetupRealmFromUri(HttpServletRequest request) { String url = request.getRequestURI(); String realm = retrieveRealmFromUrl(url); if (StringUtils.isBlank(realm)) return false; logger.info("realm: {} was retrieved from url: {}", realm, url); oidcAuthenticationHelper.setRealmForCurrentRequest(realm); return true; } }
AuthenticationRealmAwareFilter implements Filter { boolean isSuccessfulSetupRealmFromUri(HttpServletRequest request) { String url = request.getRequestURI(); String realm = retrieveRealmFromUrl(url); if (StringUtils.isBlank(realm)) return false; logger.info("realm: {} was retrieved from url: {}", realm, url); oidcAuthenticationHelper.setRealmForCurrentRequest(realm); return true; } @Autowired  AuthenticationRealmAwareFilter(OidcAuthenticationHelper oidcAuthenticationHelper); }
AuthenticationRealmAwareFilter implements Filter { boolean isSuccessfulSetupRealmFromUri(HttpServletRequest request) { String url = request.getRequestURI(); String realm = retrieveRealmFromUrl(url); if (StringUtils.isBlank(realm)) return false; logger.info("realm: {} was retrieved from url: {}", realm, url); oidcAuthenticationHelper.setRealmForCurrentRequest(realm); return true; } @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 isSuccessfulSetupRealmFromUri(HttpServletRequest request) { String url = request.getRequestURI(); String realm = retrieveRealmFromUrl(url); if (StringUtils.isBlank(realm)) return false; logger.info("realm: {} was retrieved from url: {}", realm, url); oidcAuthenticationHelper.setRealmForCurrentRequest(realm); return true; } @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; }