Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Because you mentioned CXF then I suppose you meant cxf-codegen-plugin. It's a bit of a hack but it works.</p> <p>HTTP authentication credentials can be provided using java.net.Authenticator. One need to just define his own Authenticator class which overrides getPasswordAuthentication(..) method. Then it has to be set as default Authenticator. As far as I know it can't be done declaratively (for instance using environment properties) only programatically using Authenticator.setDefault(..).</p> <p>In order to call Authenticator.setDefault(..) I would use CXF extension mechanism. Create separate maven project with similar class:</p> <pre><code>public class AuthenticatorReplacer { public AuthenticatorReplacer(Bus bus) { java.net.Authenticator.setDefault(new java.net.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("test", "test123" .toCharArray()); } }); } } </code></pre> <p>and file src\main\resources\META-INF\cxf\bus-extensions.txt with contents:</p> <pre><code>org.example.AuthenticatorReplacer::false </code></pre> <p>Then add newly created project as a dependency to cxf-codegen-plugin:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt; &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.example&lt;/groupId&gt; &lt;artifactId&gt;cxf-authenticator-replacer&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; ... &lt;/plugin&gt; </code></pre> <p>This way AuthenticatorReplacer is initialized by CXF extension mechanism and replaces default Authenticator with ours.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload