Java Code Examples for org.apache.cxf.phase.Phase#PRE_STREAM

The following examples show how to use org.apache.cxf.phase.Phase#PRE_STREAM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityInInterceptor.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
public SecurityInInterceptor(String trustStorePath, String password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchProviderException {
    super(Phase.PRE_STREAM);
    final Set<X509Certificate> rootCerts = new HashSet<X509Certificate>();
    final Set<X509Certificate> iCerts = new HashSet<X509Certificate>();

    final Path trustStoreAbsPath = EnvironmentUtils.getWildFlyHome().resolve(trustStorePath);

    KeyStore trustStore = KeyStore.getInstance("JKS");

    try (InputStream in = Files.newInputStream(trustStoreAbsPath)) {
        trustStore.load(in, password.toCharArray());

        Enumeration<String> aliases = trustStore.aliases();
        while (aliases.hasMoreElements()) {
            final String alias = aliases.nextElement();
            final X509Certificate cert = (X509Certificate) trustStore.getCertificate(alias);
            if (isSelfSigned(cert)) {
                rootCerts.add(cert);
            } else {
                iCerts.add(cert);
            }
        }
        trustedRootCerts = Collections.unmodifiableSet(rootCerts);
        intermediateCerts = Collections.unmodifiableSet(iCerts);
    }
}
 
Example 2
Source File: JwsHTTPHeaderTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testSignEmptyCustomHeader() throws Exception {

    URL busFile = JwsHTTPHeaderTest.class.getResource("client.xml");

    List<Object> providers = new ArrayList<>();
    providers.add(new JacksonJsonProvider());
    JwsWriterInterceptor jwsWriterInterceptor = new JwsWriterInterceptor();
    jwsWriterInterceptor.setProtectHttpHeaders(true);
    Set<String> headersToSign = new HashSet<>();
    headersToSign.add(HttpHeaders.CONTENT_TYPE);
    headersToSign.add(HttpHeaders.ACCEPT);
    headersToSign.add("customheader");
    jwsWriterInterceptor.setProtectedHttpHeaders(headersToSign);
    providers.add(jwsWriterInterceptor);

    String address = "http://localhost:" + PORT + "/jwsheadercustom/bookstore/books";
    WebClient client =
        WebClient.create(address, providers, busFile.toString());
    client.type("application/json").accept("application/json");

    Map<String, Object> properties = new HashMap<>();
    properties.put("rs.security.keystore.type", "jwk");
    properties.put("rs.security.keystore.alias", "2011-04-29");
    properties.put("rs.security.keystore.file",
                   "org/apache/cxf/systest/jaxrs/security/certs/jwkPrivateSet.txt");
    properties.put("rs.security.signature.algorithm", "RS256");
    WebClient.getConfig(client).getRequestContext().putAll(properties);
    CustomHeaderInterceptor customHeaderInterceptor = new CustomHeaderInterceptor(Phase.PRE_STREAM);
    customHeaderInterceptor.setEmpty(true);
    assertTrue(customHeaderInterceptor.isEmpty());
    WebClient.getConfig(client).getOutInterceptors().add(customHeaderInterceptor);

    Response response = client.post(new Book("book", 123L));
    response = client.post(new Book("book", 123L));
    assertEquals(response.getStatus(), 200);
}
 
Example 3
Source File: ServerInInterceptor.java    From peer-os with Apache License 2.0 4 votes vote down vote up
public ServerInInterceptor( SecurityManager securityManager, PeerManager peerManager )
{
    super( Phase.PRE_STREAM );
    this.securityManager = securityManager;
    this.peerManager = peerManager;
}
 
Example 4
Source File: CertConstraintsInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private CertConstraintsInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 5
Source File: StreamInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public StreamInterceptor() {
    super(Phase.PRE_STREAM);
    addBefore(SoapPreProtocolOutInterceptor.class.getName());
}
 
Example 6
Source File: OpenTracingClientStartInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public OpenTracingClientStartInterceptor(final Tracer tracer) {
    this(Phase.PRE_STREAM, tracer);
}
 
Example 7
Source File: XMLDeclarationWritingInterceptor.java    From juddi with Apache License 2.0 4 votes vote down vote up
public XMLDeclarationWritingInterceptor () { 
    super(Phase.PRE_STREAM); 
    addBefore(StaxOutInterceptor.class.getName());
}
 
Example 8
Source File: CorbaStreamOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CorbaStreamOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 9
Source File: WSDLGetOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public WSDLGetOutInterceptor() {
    super(Phase.PRE_STREAM);
    getAfter().add(StaxOutInterceptor.class.getName());
}
 
Example 10
Source File: AttachmentOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public AttachmentOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 11
Source File: HttpsTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public HttpsTokenOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 12
Source File: AbstractClient.java    From cxf with Apache License 2.0 4 votes vote down vote up
ConnectionFaultInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 13
Source File: LoggingOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public LoggingOutInterceptor() {
    this(Phase.PRE_STREAM);
}
 
Example 14
Source File: LoggingOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public LoggingOutInterceptor(LogEventSender sender) {
    super(Phase.PRE_STREAM, sender);
    addBefore(StaxOutInterceptor.class.getName());
}
 
Example 15
Source File: HttpsTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public HttpsTokenOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 16
Source File: CustomFaultInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CustomFaultInInterceptor(boolean useProcEx) {
    super(Phase.PRE_STREAM);
    this.useProcEx = useProcEx;
}
 
Example 17
Source File: XSLTOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public XSLTOutInterceptor(String xsltPath) {
    super(Phase.PRE_STREAM, StaxOutInterceptor.class, null, xsltPath);
}
 
Example 18
Source File: CustomOutFaultInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CustomOutFaultInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 19
Source File: HttpsTokenInterceptorProvider.java    From steady with Apache License 2.0 4 votes vote down vote up
public HttpsTokenInInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 20
Source File: SecurityOutFaultInterceptor.java    From cxf with Apache License 2.0 2 votes vote down vote up
public SecurityOutFaultInterceptor() {
    super(Phase.PRE_STREAM);

}