@Override protected String get(final ConfigurationKey configurationKey) { final String property = configurationKey.getName(); final String filterSpecificProperty = this.simpleFilterName + "." + property; final String filterSpecificValue = this.properties.getProperty(filterSpecificProperty); if (CommonUtils.isNotEmpty(filterSpecificValue)) { return filterSpecificValue; } return this.properties.getProperty(property); }
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) throws IOException, ServletException { final String parameter = CommonUtils.safeGetParameter((HttpServletRequest) request, this.requestParameterName); if (CommonUtils.isNotEmpty(parameter)) { for (final String key : this.delegators.keySet()) { if ((parameter.equals(key) && this.exactMatch) || (parameter.matches(key) && !this.exactMatch)) { final Filter filter = this.delegators.get(key); logger.debug("Match found for parameter [{}] with value [{}]. Delegating to filter [{}]", this.requestParameterName, parameter, filter.getClass().getName()); filter.doFilter(request, response, filterChain); return; } } } logger.debug("No match found for parameter [{}] with value [{}]", this.requestParameterName, parameter); if (this.defaultFilter != null) { this.defaultFilter.doFilter(request, response, filterChain); } else { filterChain.doFilter(request, response); } }
/** * Initialization method. Called by Filter's init method or by Spring. Similar in concept to the InitializingBean interface's * afterPropertiesSet(); */ public void init() { CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null."); CommonUtils.assertNotNull(this.serviceParameterName, "serviceParameterName cannot be null."); CommonUtils.assertTrue(CommonUtils.isNotEmpty(this.serverName) || CommonUtils.isNotEmpty(this.service), "serverName or service must be set."); }
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) throws IOException, ServletException { final String parameter = CommonUtils.safeGetParameter((HttpServletRequest) request, this.requestParameterName); if (CommonUtils.isNotEmpty(parameter)) { for (final Iterator iter = this.delegators.keySet().iterator(); iter .hasNext();) { final String key = (String) iter.next(); if ((parameter.equals(key) && this.exactMatch) || (parameter.matches(key) && !this.exactMatch)) { final Filter filter = (Filter) this.delegators.get(key); if (log.isDebugEnabled()) { log.debug("Match found for parameter [" + this.requestParameterName + "] with value [" + parameter + "]. Delegating to filter [" + filter.getClass().getName() + "]"); } filter.doFilter(request, response, filterChain); return; } } } log.debug("No match found for parameter [" + this.requestParameterName + "] with value [" + parameter + "]"); if (this.defaultFilter != null) { this.defaultFilter.doFilter(request, response, filterChain); } else { filterChain.doFilter(request, response); } }
/** * Initialization method. Called by Filter's init method or by Spring. Similar in concept to the InitializingBean interface's * afterPropertiesSet(); */ public void init() { CommonUtils.assertTrue(CommonUtils.isNotEmpty(this.serverName) || CommonUtils.isNotEmpty(this.service), "serverName or service must be set."); CommonUtils.assertTrue(CommonUtils.isBlank(this.serverName) || CommonUtils.isBlank(this.service), "serverName and service cannot both be set. You MUST ONLY set one."); }
public void testIsNotEmpty() { assertTrue(CommonUtils.isNotEmpty("test")); assertTrue(CommonUtils.isNotEmpty(" test")); assertFalse(CommonUtils.isNotEmpty("")); assertFalse(CommonUtils.isNotEmpty(null)); assertTrue(CommonUtils.isNotEmpty(" ")); }
public String getProxyTicketIdFor(final String proxyGrantingTicketId, final String targetService) { final String url = constructUrl(proxyGrantingTicketId, targetService); final String response = CommonUtils.getResponseFromServer(url, this.encoding); final String error = XmlUtils.getTextForElement(response, "proxyFailure"); if (CommonUtils.isNotEmpty(error)) { log.debug(error); return null; } return XmlUtils.getTextForElement(response, "proxyTicket"); }
String error = XmlUtils.getTextForElement(response, "authenticationFailure"); if (CommonUtils.isNotEmpty(error)) { return error;
String error = XmlUtils.getTextForElement(response, "authenticationFailure"); if (CommonUtils.isNotEmpty(error)) { return error;
public String getProxyTicketIdFor(final String proxyGrantingTicketId, final String targetService) { CommonUtils.assertNotNull(proxyGrantingTicketId, "proxyGrantingTicketId cannot be null."); CommonUtils.assertNotNull(targetService, "targetService cannot be null."); final URL url = constructUrl(proxyGrantingTicketId, targetService); final String response; if (this.urlConnectionFactory != null) { response = CommonUtils.getResponseFromServer(url, this.urlConnectionFactory, this.encoding); } else { response = CommonUtils.getResponseFromServer(url, this.encoding); } final String error = XmlUtils.getTextForElement(response, "proxyFailure"); if (CommonUtils.isNotEmpty(error)) { logger.debug(error); return null; } final String ticket = XmlUtils.getTextForElement(response, "proxyTicket"); logger.debug("Got proxy ticket {}", ticket); return ticket; }