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 . These examples are extracted from open source projects. 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
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 Project: cxf   File: JwsHTTPHeaderTest.java    License: 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
public HttpsTokenOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 4
public HttpsTokenInInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 5
Source Project: cxf   File: CustomOutFaultInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public CustomOutFaultInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 6
Source Project: cxf   File: XSLTOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public XSLTOutInterceptor(String xsltPath) {
    super(Phase.PRE_STREAM, StaxOutInterceptor.class, null, xsltPath);
}
 
Example 7
Source Project: cxf   File: CustomFaultInInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public CustomFaultInInterceptor(boolean useProcEx) {
    super(Phase.PRE_STREAM);
    this.useProcEx = useProcEx;
}
 
Example 8
public HttpsTokenOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 9
Source Project: cxf   File: LoggingOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public LoggingOutInterceptor(LogEventSender sender) {
    super(Phase.PRE_STREAM, sender);
    addBefore(StaxOutInterceptor.class.getName());
}
 
Example 10
Source Project: cxf   File: LoggingOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public LoggingOutInterceptor() {
    this(Phase.PRE_STREAM);
}
 
Example 11
Source Project: cxf   File: AbstractClient.java    License: Apache License 2.0 4 votes vote down vote up
ConnectionFaultInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 12
Source Project: peer-os   File: ServerInInterceptor.java    License: 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 13
Source Project: cxf   File: AttachmentOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public AttachmentOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 14
Source Project: cxf   File: WSDLGetOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public WSDLGetOutInterceptor() {
    super(Phase.PRE_STREAM);
    getAfter().add(StaxOutInterceptor.class.getName());
}
 
Example 15
Source Project: cxf   File: CorbaStreamOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public CorbaStreamOutInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 16
public XMLDeclarationWritingInterceptor () { 
    super(Phase.PRE_STREAM); 
    addBefore(StaxOutInterceptor.class.getName());
}
 
Example 17
public OpenTracingClientStartInterceptor(final Tracer tracer) {
    this(Phase.PRE_STREAM, tracer);
}
 
Example 18
Source Project: cxf   File: StreamInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public StreamInterceptor() {
    super(Phase.PRE_STREAM);
    addBefore(SoapPreProtocolOutInterceptor.class.getName());
}
 
Example 19
Source Project: cxf   File: CertConstraintsInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
private CertConstraintsInterceptor() {
    super(Phase.PRE_STREAM);
}
 
Example 20
Source Project: cxf   File: SecurityOutFaultInterceptor.java    License: Apache License 2.0 2 votes vote down vote up
public SecurityOutFaultInterceptor() {
    super(Phase.PRE_STREAM);

}