You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2017/10/19 11:34:39 UTC

Re: providing basic auth via wadl2java?

OK, I've renamed it to "authentication", but please do test it before it 
gets released

Sergey
On 15/09/17 16:03, Shan Syed wrote:
> Truthfully I think "authentication" is a more appropriate word, but it's
> not a big deal ;)
> 
> On Thu, Sep 14, 2017 at 5:16 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
> 
>> Thanks, should we rename 'authorization' to 'authentication' ?
>>
>> First I named it 'nameAndPassword', then thought, well, too specific,
>> renamed it to 'authorization' (prob because of Http Authorization header).
>> May be we will leave it as is...
>>
>> Sergey
>>
>> On 14/09/17 18:52, Shan Syed wrote:
>>
>>> yes, it's communicating fine and processing the remote WADL :)
>>>
>>> thanks!
>>>
>>> On Thu, Sep 14, 2017 at 12:07 PM, Sergey Beryozkin <sb...@gmail.com>
>>> wrote:
>>>
>>> Can you please try 3.1.14-SNAPSHOT now ?
>>>>
>>>> Sergey
>>>>
>>>> On 13/09/17 18:34, Shan Syed wrote:
>>>>
>>>> ok, thanks, looking forward to it!
>>>>>
>>>>> On Wednesday, September 13, 2017, Sergey Beryozkin <
>>>>> sberyozkin@gmail.com>
>>>>> wrote:
>>>>>
>>>>> For some reasons I thought it was about retrieving the internal
>>>>> references
>>>>>
>>>>>> only, so more work is needed then in 3.1.14-SNAPSHOT
>>>>>>
>>>>>> On 13/09/17 16:19, Shan Syed wrote:
>>>>>>
>>>>>> So I just got the 3.1.14-SNAPSHOT working (sorry, was a silly issue),
>>>>>> and
>>>>>>
>>>>>>> still getting 401 from it.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Sep 13, 2017 at 11:12 AM, Shan Syed <sh...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> So outside of my snapshot issues, I updated my local
>>>>>>> jaxrs-toolspec.xml,
>>>>>>>
>>>>>>> locally here:
>>>>>>>> .m2\repository\org\apache\cxf\cxf-tools-wadlto-jaxrs\3.1.13
>>>>>>>>
>>>>>>>> I updated the option section for authorization, so all the items
>>>>>>>> match
>>>>>>>>
>>>>>>>>                 <option id="authorization" maxOccurs="1">
>>>>>>>>                     <annotation>
>>>>>>>>                         Specifies a colon separated user name and
>>>>>>>> password
>>>>>>>> for
>>>>>>>> retrieving the
>>>>>>>>                         remote WADL content from the servers requiring
>>>>>>>> Basic
>>>>>>>> authentication
>>>>>>>>                     </annotation>
>>>>>>>>                     <associatedArgument placement="afterSpace">
>>>>>>>>                         <annotation>authorization</annotation>
>>>>>>>>                     </associatedArgument>
>>>>>>>>                     <switch>authorization</switch>
>>>>>>>>                 </option>
>>>>>>>> In my POM:
>>>>>>>>
>>>>>>>> <wadlOptions>
>>>>>>>> <wadlOption>
>>>>>>>> <wadl>https://whatever/api/somemodel?_wadl</wadl>
>>>>>>>> <impl>true</impl>
>>>>>>>> <packagename>com.whatever</packagename>
>>>>>>>> <extraargs>
>>>>>>>> <extraarg>-authorization</extraarg>
>>>>>>>> <extraarg>apiuser:apiuser</extraarg>
>>>>>>>> </extraargs>
>>>>>>>> </wadlOption>
>>>>>>>> </wadlOptions>
>>>>>>>>
>>>>>>>> I'm still getting a 401
>>>>>>>>
>>>>>>>> java.io.IOException: Server returned HTTP response code: 401 for URL:
>>>>>>>> https://... snip -> [Help 1]
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Sep 13, 2017 at 10:25 AM, Shan Syed <sh...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Unfortunately, I can't seem to build off of the snapshots; I have
>>>>>>>> this
>>>>>>>> in
>>>>>>>>
>>>>>>>> my POM:
>>>>>>>>>
>>>>>>>>> <repositories>
>>>>>>>>> <repository>
>>>>>>>>> <id>apache-snapshot-repo</id>
>>>>>>>>> <url>http://repository.apache.org/snapshots</url>
>>>>>>>>> <snapshots>
>>>>>>>>> <enabled>true</enabled>
>>>>>>>>> </snapshots>
>>>>>>>>> </repository>
>>>>>>>>> </repositories>
>>>>>>>>>
>>>>>>>>> ..SNIP..
>>>>>>>>> <plugin>
>>>>>>>>> <groupId>org.apache.cxf</groupId>
>>>>>>>>> <artifactId>cxf-wadl2java-plugin</artifactId>
>>>>>>>>> <version>3.1.14-SNAPSHOT</version>
>>>>>>>>> <executions>
>>>>>>>>> ..SNIP..
>>>>>>>>>
>>>>>>>>> Getting this error:
>>>>>>>>>
>>>>>>>>> "[ERROR] Plugin org.apache.cxf:cxf-wadl2java-plugin:3.1.14-SNAPSHOT
>>>>>>>>> or
>>>>>>>>> one of its dependencies could not be resolved: Could not find
>>>>>>>>> artifact
>>>>>>>>> org.apache.cxf:cxf-wadl2java-plugin:jar
>>>>>>>>> :3.1.14-SNAPSHOT -> [Help 1]"
>>>>>>>>>
>>>>>>>>> Any ideas? I looked around in the repo, nothing seems off at a first
>>>>>>>>> glance, I can't see why it's not being found.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Sep 12, 2017 at 6:09 AM, Sergey Beryozkin <
>>>>>>>>> sberyozkin@gmail.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I've deployed a cxf-tools-wadlto-jaxrs/3.1.14-SNAPSHOT with the
>>>>>>>>> fix,
>>>>>>>>>
>>>>>>>>> can you try it ?
>>>>>>>>>> If it works then may be you can just update the jaxrs-toolspec.xml
>>>>>>>>>> in
>>>>>>>>>> the 3.1.13 version in the .m2 repository and use till 3.1.14 is out
>>>>>>>>>>
>>>>>>>>>> Sergey
>>>>>>>>>>
>>>>>>>>>> On 11/09/17 22:17, Sergey Beryozkin wrote:
>>>>>>>>>>
>>>>>>>>>> Yes, I did it few days before the release,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> https://github.com/apache/cxf/blob/cxf-3.2.0/tools/wadlto/ja
>>>>>>>>>>> xrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-to
>>>>>>>>>>> olspec.xml#L262
>>>>>>>>>>>
>>>>>>>>>>> I changed the 'id', but did not changed the switch...That's why
>>>>>>>>>>> it's
>>>>>>>>>>> always useful to test the snapshot...
>>>>>>>>>>>
>>>>>>>>>>> The fix will be avail in 3.1.14/3.2.1
>>>>>>>>>>>
>>>>>>>>>>> Sergey
>>>>>>>>>>> On 11/09/17 22:12, Shan Syed wrote:
>>>>>>>>>>>
>>>>>>>>>>> Also, I just managed to grab the 3.2.0 release (congrats!)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> I noticed that wadl2java has this option now: -namePassword
>>>>>>>>>>>> <namePassword>
>>>>>>>>>>>> though in your commits, it looks like this was later renamed to
>>>>>>>>>>>> "authorization"
>>>>>>>>>>>>
>>>>>>>>>>>> I tried both via the bat file, and "authorization" is an unknown
>>>>>>>>>>>> option
>>>>>>>>>>>>
>>>>>>>>>>>> there are no complaints when I supply the namePassword though,
>>>>>>>>>>>> like
>>>>>>>>>>>> this:
>>>>>>>>>>>> \apache-cxf-3.2.0\bin>wadl2java -namePassword apiuser:apiuser
>>>>>>>>>>>> https://whatever:8000/api/rest/somemodel?_wadl
>>>>>>>>>>>>
>>>>>>>>>>>> I still get:  Server returned HTTP response code: 401
>>>>>>>>>>>>
>>>>>>>>>>>> Looks like the auth pair didn't seem to affect the connection?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Mon, Sep 11, 2017 at 3:39 PM, Shan Syed <sh...@gmail.com>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi, I I tried this on 3.0.15 just now, and it doesn't seem like
>>>>>>>>>>>> the
>>>>>>>>>>>>
>>>>>>>>>>>> "authorization" is available as an option for me. In my POM:
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> <wadlOption>
>>>>>>>>>>>>> <wadl>https://whatever8000/api/rest/somemodel?_wadl</wadl>
>>>>>>>>>>>>> <impl>true</impl>
>>>>>>>>>>>>> <authorization>apiuser:apiuser</authorization>
>>>>>>>>>>>>> <packagename>com.whatever</packagename>
>>>>>>>>>>>>> </wadlOption>
>>>>>>>>>>>>>
>>>>>>>>>>>>> "Cannot find 'authorization' in class
>>>>>>>>>>>>> org.apache.cxf.maven_plugin.wa
>>>>>>>>>>>>> dlto.WadlOption"
>>>>>>>>>>>>>
>>>>>>>>>>>>> Does the option go somewhere else? Thanks!
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Fri, Sep 8, 2017 at 12:23 PM, Shan Syed <sh...@gmail.com>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Great, I will try it when it's available!
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, Sep 6, 2017 at 11:39 AM, Sergey Beryozkin <
>>>>>>>>>>>>>> sberyozkin@gmail.com>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Np. hope that code I added will work from the 1st attempt :-),
>>>>>>>>>>>>>> I
>>>>>>>>>>>>>> did
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> not
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> want to introduce a strong dep on the CXF JAX-RS client code,
>>>>>>>>>>>>>>> so
>>>>>>>>>>>>>>> resorted
>>>>>>>>>>>>>>> to writing some HttpUrlConnection code which is tricky to do
>>>>>>>>>>>>>>> right...
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 06/09/17 16:32, Shan Syed wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> amazing, thank you
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Friday, September 1, 2017, Sergey Beryozkin <
>>>>>>>>>>>>>>>> sberyozkin@gmail.com>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I've created this issue:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> https://issues.apache.org/jira/browse/CXF-7492
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> but will likely have no time to complete it early next week,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> but at least it will be tracked
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>>>>>>>> On 25/08/17 15:14, Sergey Beryozkin wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I see, makes sense to add a new switch
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Sergey
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 25/08/17 14:52, Shan Syed wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I don't have explicit access to the header via the command
>>>>>>>>>>>>>>>>>> line
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> wadl2java,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> nor the maven plugin
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Fri, Aug 25, 2017 at 6:24 AM, Sergey Beryozkin <
>>>>>>>>>>>>>>>>>>> sberyozkin@gmail.com>
>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Why can't they be sent as the header ? Otherwise I guess
>>>>>>>>>>>>>>>>>>> one
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> needs
>>>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>>>> configure the HTTP container somehow for the name and
>>>>>>>>>>>>>>>>>>>> password
>>>>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>>>> extracted
>>>>>>>>>>>>>>>>>>>> out of URI and matched against the BasicAuth module...
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Sergey
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On 25/08/17 01:10, Shan Syed wrote:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hey there,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I need to generate client code for a WADL, hosted on a
>>>>>>>>>>>>>>>>>>>> remote
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> server I
>>>>>>>>>>>>>>>>>>>>> don't control.
>>>>>>>>>>>>>>>>>>>>> The WADL has very deep includes, that reference other
>>>>>>>>>>>>>>>>>>>>> xml
>>>>>>>>>>>>>>>>>>>>> files
>>>>>>>>>>>>>>>>>>>>> hosted
>>>>>>>>>>>>>>>>>>>>> on
>>>>>>>>>>>>>>>>>>>>> the same server.
>>>>>>>>>>>>>>>>>>>>> Downloading them all isn't practical, because it's a
>>>>>>>>>>>>>>>>>>>>> very
>>>>>>>>>>>>>>>>>>>>> deep
>>>>>>>>>>>>>>>>>>>>> hierarchy.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> The WADL is also served off of a webserver that asserts
>>>>>>>>>>>>>>>>>>>>> basic
>>>>>>>>>>>>>>>>>>>>> auth.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I'm trying both the cxf wadl2java download, and the
>>>>>>>>>>>>>>>>>>>>> maven
>>>>>>>>>>>>>>>>>>>>> plugin;
>>>>>>>>>>>>>>>>>>>>> neither
>>>>>>>>>>>>>>>>>>>>> seem to work when I provide basic auth details like
>>>>>>>>>>>>>>>>>>>>> this:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> https://whateverusernamer:some
>>>>>>>>>>>>>>>>>>>>> password@whatever.com?wadl
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> A 401 error is returned, and the basic auth parameters
>>>>>>>>>>>>>>>>>>>>> aren't
>>>>>>>>>>>>>>>>>>>>> sent
>>>>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>> server this way.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Is there a way to specify user/password for basic auth
>>>>>>>>>>>>>>>>>>>>> on
>>>>>>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>>>>>>> remote
>>>>>>>>>>>>>>>>>>>>> WADL?
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Sergey Beryozkin
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Talend Community Coders
>>>>>>>>>>>>>>>>> http://coders.talend.com/
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>
>