You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2019/04/25 11:57:38 UTC

svn commit: r1044132 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-http-signature.html

Author: buildbot
Date: Thu Apr 25 11:57:38 2019
New Revision: 1044132

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-http-signature.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jax-rs-http-signature.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-http-signature.html (original)
+++ websites/production/cxf/content/docs/jax-rs-http-signature.html Thu Apr 25 11:57:38 2019
@@ -111,11 +111,11 @@ Apache CXF -- JAX-RS HTTP Signature
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1556111051083 {padding: 0px;}
-div.rbtoc1556111051083 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1556111051083 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1556193420178 {padding: 0px;}
+div.rbtoc1556193420178 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1556193420178 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1556111051083">
+/*]]>*/</style></p><div class="toc-macro rbtoc1556193420178">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSHTTPSignature-Introduction">Introduction</a></li><li><a shape="rect" href="#JAX-RSHTTPSignature-MavenDependencies">Maven Dependencies</a></li><li><a shape="rect" href="#JAX-RSHTTPSignature-Configuration">Configuration</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSHTTPSignature-Providers">Providers</a></li><li><a shape="rect" href="#JAX-RSHTTPSignature-FinegrainedConfiguration">Fine grained Configuration</a></li><li><a shape="rect" href="#JAX-RSHTTPSignature-ConfigurationProperties">Configuration Properties</a></li></ul>
 </li></ul>
@@ -126,8 +126,8 @@ div.rbtoc1556111051083 li {margin-left:
   &lt;version&gt;3.3.2&lt;/version&gt;
 &lt;/dependency&gt;
 </pre>
-</div></div><h1 id="JAX-RSHTTPSignature-Configuration">Configuration</h1><p>CXF supports HTTP Signature creation and verification on both the client and service side.</p><h2 id="JAX-RSHTTPSignature-Providers">Providers</h2><p>To enable HTTP Signature in CXF, it is necessary to add one of the following providers to the client or endpoint:</p><ul><li>Client Outbound Signature Creation: org.apache.cxf.rs.security.httpsignature.filters.CreateSignatureClientFilter</li><li>Client Inbound Signature Verification: org.apache.cxf.rs.security.httpsignature.filters.VerifySignatureClientFilter</li><li>Service Outbound Signature Creation: org.apache.cxf.rs.security.httpsignature.filters.CreateSignatureFilter</li><li>Service Inbound Signature Verification: org.apache.cxf.rs.security.httpsignature.filters.VerifySignatureFilter</li></ul><p>For example in code:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>WebCli
 ent Config</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">CreateSignatureClientFilter signatureFilter = new CreateSignatureClientFilter();
+</div></div><h1 id="JAX-RSHTTPSignature-Configuration">Configuration</h1><p>CXF supports HTTP Signature creation and verification on both the client and service side. Payload integrity is supported by digesting the payload and inserting the result into a "Digest" header, which is also signed by HTTP Signature.</p><h2 id="JAX-RSHTTPSignature-Providers">Providers</h2><p>To enable HTTP Signature in CXF, it is necessary to add one of the following providers to the client or endpoint:</p><ul><li>Client / Service Outbound Signature Creation: org.apache.cxf.rs.security.httpsignature.filters.CreateSignatureInterceptor</li><li>Client Inbound Signature Verification: org.apache.cxf.rs.security.httpsignature.filters.VerifySignatureClientFilter</li><li>Service Inbound Signature Verification: org.apache.cxf.rs.security.httpsignature.filters.VerifySignatureFilter</li></ul><p>For example in code:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style
 ="border-bottom-width: 1px;"><b>WebClient Config</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">CreateSignatureInterceptor signatureFilter = new CreateSignatureInterceptor();
 
 String address = "http://localhost:" + PORT + "/httpsig/bookstore/books";
 WebClient client =
@@ -145,8 +145,8 @@ WebClient client =
        &lt;ref bean="httpSignatureVerifier"/&gt;
    &lt;/jaxrs:providers&gt;
 &lt;/jaxrs:server&gt;</pre>
-</div></div><h2 id="JAX-RSHTTPSignature-FinegrainedConfiguration">Fine grained Configuration</h2><p>As well as adding the desired providers (see above), we need to configure them (for example the keys to use, the headers to sign, etc.). There are two options for doing this. In this section we'll look at configuring the providers directly, which allows for a more fine-grained configuration. See below for an alternative using configuration properties that retrieves keys from keystores.</p><p>For outbound signature we need to configure the CreateSignatureClientFilter + CreateSignatureFilter providers with a MessageSigner instance. The MessageSigner contains a number of different constructors that can be used depending on the desired functionality. At a minimum, we need to supply the PrivateKey instance to sign the message, as well as the "Key Id" as defined in the spec. We can also supply the signature algorithm name - if not specified this defaults to "rsa-sha256". Similarly we can su
 pply the security provider name, which defaults to "SunRsaSign".</p><p>We can also supply a list of HTTP headers to sign. By default it signs all of the HTTP headers that are made available to it by CXF. On the client side it will also sign the HTTP method and Path via "(request-target)".</p><p>Here is an example from the tests:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">CreateSignatureClientFilter signatureFilter = new CreateSignatureClientFilter();
+</div></div><h2 id="JAX-RSHTTPSignature-FinegrainedConfiguration">Fine grained Configuration</h2><p>As well as adding the desired providers (see above), we need to configure them (for example the keys to use, the headers to sign, etc.). There are two options for doing this. In this section we'll look at configuring the providers directly, which allows for a more fine-grained configuration. See below for an alternative using configuration properties that retrieves keys from keystores.</p><p>For outbound signature we need to configure the CreateSignatureInterceptor provider with a MessageSigner instance. The MessageSigner contains a number of different constructors that can be used depending on the desired functionality. At a minimum, we need to supply the PrivateKey instance to sign the message, as well as the "Key Id" as defined in the spec. We can also supply the signature algorithm name - if not specified this defaults to "rsa-sha256". Similarly we can supply the security provider
  name, which defaults to "SunRsaSign".</p><p>We can also supply a list of HTTP headers to sign. By default it signs all of the HTTP headers that are made available to it by CXF. On the client side it will also sign the HTTP method and Path via "(request-target)".</p><p>Here is an example from the tests:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">CreateSignatureInterceptor signatureFilter = new CreateSignatureInterceptor();
 KeyStore keyStore = KeyStore.getInstance("JKS");
 keyStore.load(ClassLoaderUtils.getResourceAsStream("keys/alice.jks", this.getClass()),
     "password".toCharArray());
@@ -188,7 +188,7 @@ client.type("application/xml").accept("a
 &lt;/jaxrs:server&gt;</pre>
 </div></div><h2 id="JAX-RSHTTPSignature-ConfigurationProperties">Configuration Properties</h2><p>An alternative to configure the MessageSigner, MessageVerifier instances as documented in the previous section is to use the following security configuration properties instead. These properties rely on obtaining the private keys to sign the messages, as well as the public keys used to verify the messages, from a keystore stored in the local filesystem. Note that the "Key Id" is ignored, we verify the message using the public key defined in the configuration properties.</p><p>The following configuration properties can be used to configure HTTP Signature with the various filters. Note that they are shared for the most part with <a shape="rect" href="jax-rs-jose.html">JAX-RS JOSE</a>.</p><div class="table-wrap"><table class="wrapped confluenceTable"><colgroup span="1"><col span="1"><col span="1"><col span="1"></colgroup><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Configurat
 ion Tag</th><th colspan="1" rowspan="1" class="confluenceTh">Default</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.keystore</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">The Java KeyStore Object to use. This configuration tag is used if you want to pass the KeyStore Object through dynamically.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>rs.security.keystore.type</p></td><td colspan="1" rowspan="1" class="confluenceTd">JKS</td><td colspan="1" rowspan="1" class="confluenceTd"><p>The keystore type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.keystore.password</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">The password required to access the keystore.</td></tr><tr><td colspan="1" rowspan="
 1" class="confluenceTd">rs.security.keystore.alias</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">&#160;The keystore alias corresponding to the key to use.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.keystore.file</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">The path to the keystore file.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.key.password</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">The password required to access the private key (in the keystore).</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.key.password.provider</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">A reference to a Privat
 eKeyPasswordProvider instance used to retrieve passwords to access keys.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.signature.out.properties</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The signature properties file for Compact or JSON signature creation. If not specified then it falls back to "rs.security.signature.properties".</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.signature.in.properties</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The signature properties file for Compact or JSON signature verification. If not specified then it falls back to "rs.security.signature.properties".</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.signature.properties</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><
 td colspan="1" rowspan="1" class="confluenceTd">The signature properties file for Compact or JSON signature creation/verification.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.signature.algorithm</td><td colspan="1" rowspan="1" class="confluenceTd">rsa-sha256</td><td colspan="1" rowspan="1" class="confluenceTd">The signature algorithm to use.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.http.signature.key.id</td><td colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td colspan="1" rowspan="1" class="confluenceTd">The signature key id. This is a required configuration option on the outbound side.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.http.signature.out.headers</td><td colspan="1" rowspan="1" class="confluenceTd">all headers incl "(request-target)"</td><td colspan="1" rowspan="1" class="confluenceTd"><p>A list of String values which correspond to the list of HTTP headers that
  will be signed in the outbound request.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">rs.security.http.signature.in.headers</td><td colspan="1" rowspan="1" class="confluenceTd">"digest", and "(request-target)" for a client request.</td><td colspan="1" rowspan="1" class="confluenceTd"><p>A list of String values which correspond to the list of HTTP headers that must be signed in the inbound request. By default, a client request must sign "(request-target)". In addition,&#160;both a client request and service response must sign "digest", unless it is a GET request.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span class="blob-code-inner"><span class="pl-s">rs.security.http.signature.digest.algorithm</span></span></td><td colspan="1" rowspan="1" class="confluenceTd">SHA-256</td><td colspan="1" rowspan="1" class="confluenceTd"><span class="blob-code-inner"><span class="pl-c">The digest algorithm to use when digesting the payload.<br clear="none"
 ></span></span></td></tr></tbody></table></div><p>Here is a Java example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default">List&lt;Object&gt; providers = new ArrayList&lt;&gt;();
-providers.add(new CreateSignatureClientFilter());
+providers.add(new CreateSignatureInterceptor());
 providers.add(new VerifySignatureClientFilter());
 String address = "http://localhost:" + PORT + "/httpsigresponse/bookstore/books";
 WebClient client = WebClient.create(address, providers, busFile.toString());
@@ -214,7 +214,7 @@ rs.security.http.signature.key.id=alice-
     &lt;/jaxrs:serviceBeans&gt;
     &lt;jaxrs:providers&gt;
         &lt;bean class="org.apache.cxf.rs.security.httpsignature.filters.VerifySignatureFilter" /&gt;
-        &lt;bean class="org.apache.cxf.rs.security.httpsignature.filters.CreateSignatureFilter" /&gt;
+        &lt;bean class="org.apache.cxf.rs.security.httpsignature.filters.CreateSignatureInterceptor" /&gt;
     &lt;/jaxrs:providers&gt;
     &lt;jaxrs:properties&gt;
         &lt;entry key="rs.security.signature.in.properties"