private boolean isClientDisconnected(Throwable ex) { String exName = (String)inMessage.getContextualProperty("disconnected.client.exception.class"); if (exName != null) { return exName.equals(IOException.class.getName()) || exName.equals(ex.getClass().getName()); } return false; }
private boolean logSensitiveHeaders() { // Not allowed by default return PropertyUtils.isTrue(message.getContextualProperty(ALLOW_LOGGING_SENSITIVE_HEADERS)); }
private static void checkAllowedRedirectUri(String conduitName, String lastURL, String newURL, Message message) throws IOException { if (newURL != null) { URI newUri = URI.create(newURL); if (MessageUtils.getContextualBoolean(message, AUTO_REDIRECT_SAME_HOST_ONLY)) { URI lastUri = URI.create(lastURL); // This can be further restricted to make sure newURL completely contains lastURL // though making sure the same HTTP scheme and host are preserved should be enough if (!newUri.getScheme().equals(lastUri.getScheme()) || !newUri.getHost().equals(lastUri.getHost())) { String msg = "Different HTTP Scheme or Host Redirect detected on Conduit '" + conduitName + "' on '" + newURL + "'"; LOG.log(Level.INFO, msg); throw new IOException(msg); } } String allowedRedirectURI = (String)message.getContextualProperty(AUTO_REDIRECT_ALLOWED_URI); if (allowedRedirectURI != null && !newURL.startsWith(allowedRedirectURI)) { String msg = "Forbidden Redirect URI " + newURL + "detected on Conduit '" + conduitName; LOG.log(Level.INFO, msg); throw new IOException(msg); } } }
public Servlet3Continuation() { req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE, inMessage.getExchange().getInMessage()); callback = inMessage.getExchange().get(ContinuationCallback.class); blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART)); context = req.startAsync(); context.addListener(this); }
public String getAuthorization(AuthorizationPolicy authPolicy, URI currentURI, Message message, String fullHeader) { if (authPolicy.getUserName() != null && authPolicy.getPassword() != null) { boolean encodeBasicAuthWithIso8859 = PropertyUtils.isTrue( message.getContextualProperty(ENCODE_BASIC_AUTH_WITH_ISO8859)); return getBasicAuthHeader(authPolicy.getUserName(), authPolicy.getPassword(), encodeBasicAuthWithIso8859); } return null; }
(GSSCredential)message.getContextualProperty(GSSCredential.class.getName());
Object setCtForEmptyRequestProp = message.getContextualProperty(SET_EMPTY_REQUEST_CT_PROPERTY);
@SuppressWarnings("unchecked") private <T, Y> SearchConditionVisitor<T, Y> getVisitor() { Object visitor = message.getContextualProperty(SearchUtils.SEARCH_VISITOR_PROPERTY); if (visitor == null) { return null; } //TODO: consider introducing SearchConditionVisitor.getBeanClass && // SearchConditionVisitor.getQueryClass to avoid such casts return (SearchConditionVisitor<T, Y>)visitor; }
public void handleMessage(Message message) throws Fault { final CertConstraints certConstraints = (CertConstraints)message.getContextualProperty(CertConstraints.class.getName()); if (certConstraints == null) { return;
public static String getKeyAlgorithm(Message m, Properties props, String propName, String defaultAlg) { String algo = props != null ? props.getProperty(propName) : null; if (algo == null && m != null) { algo = (String)m.getContextualProperty(propName); } if (algo == null) { algo = defaultAlg; } return algo; }
private static void mapSecurityProps(Message message, Map<String, Object> ctx) { for (String s : SecurityConstants.ALL_PROPERTIES) { Object v = message.getContextualProperty(s); if (v != null) { ctx.put(s, v); } } }
public static Integer getInteger(Message message, String key) { Object o = message.getContextualProperty(key); if (o instanceof Integer) { return (Integer)o; } else if (o instanceof Number) { return ((Number)o).intValue(); } else if (o instanceof String) { return Integer.valueOf((String)o); } return null; } }
public static URL getConfigFileURL(Message message, String configFileKey, String configFileDefault) { Object o = message.getContextualProperty(configFileKey); if (o == null) { o = configFileDefault; } return loadResource(message, o); }
protected BeanValidationProvider getProvider(Message message) { if (provider == null) { Object prop = message.getContextualProperty(BeanValidationProvider.class.getName()); if (prop != null) { provider = (BeanValidationProvider)prop; } else { provider = new BeanValidationProvider(); } } return provider; }
public void setPayload(Source s) { Message message = msgContext.getWrappedMessage(); Service.Mode mode = (Service.Mode)msgContext.getWrappedMessage() .getContextualProperty(Service.Mode.class.getName()); SOAPMessage m = message.getContent(SOAPMessage.class); if (m != null && !MessageUtils.isOutbound(message)) {
protected boolean shouldBuffer(Message message) { Object en = message.getContextualProperty(OUT_BUFFERING); boolean allowBuffer = true; boolean buffer = false; if (en != null) { buffer = Boolean.TRUE.equals(en) || "true".equals(en); allowBuffer = !(Boolean.FALSE.equals(en) || "false".equals(en)); } // need to cache the events in case validation fails or buffering is enabled return buffer || (allowBuffer && shouldValidate(message) && !isRequestor(message)); }
public Object getContextualProperty(Object key) { Object value = m.getContextualProperty(key.toString()); if (value == null && key.getClass() == Class.class) { return m.getExchange().get((Class<?>)key); } return value; }
public static Properties loadEncryptionOutProperties(boolean required) { Message m = PhaseInterceptorChain.getCurrentMessage(); String keyEncryptionAlgorithm = (String)m.getContextualProperty(JoseConstants.RSSEC_ENCRYPTION_KEY_ALGORITHM); if (keyEncryptionAlgorithm != null && AlgorithmUtils.PBES_HS_SET.contains(keyEncryptionAlgorithm)) { // We don't need to load the keystore properties for the PBES case required = false; } return KeyManagementUtils.loadStoreProperties(m, required, JoseConstants.RSSEC_ENCRYPTION_OUT_PROPS, JoseConstants.RSSEC_ENCRYPTION_PROPS); }
@Override public <T> T getResource(Class<T> cls) { ResourceProvider rp = null; Object propValue = m.getContextualProperty(CONTEXT_PROVIDER_PROP); if (propValue instanceof ResourceContextProvider) { rp = ((ResourceContextProvider)propValue).getResourceProvider(cls); } else { rp = new PerRequestResourceProvider(cls); } T resource = cls.cast(rp.getInstance(m)); return doInitResource(cls, resource); }
public Servlet3Continuation() { req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE, inMessage.getExchange().getInMessage()); callback = inMessage.getExchange().get(ContinuationCallback.class); blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART)); context = req.startAsync(); context.addListener(this); }