This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 231819 - REST Client wizard with BASIC Authentication is incorrectly generated
Summary: REST Client wizard with BASIC Authentication is incorrectly generated
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.3.1
Hardware: All All
: P2 normal (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-26 08:57 UTC by Milan Kuchtiak
Modified: 2013-06-27 02:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Kuchtiak 2013-06-26 08:57:43 UTC
Note that, the wizard generates public setUserNamePassword method:
=========================
public void setUsernamePassword(String username, String password) {
        client.register(new org.glassfish.jersey.client.filter.HttpBasicAuthFilter(username, password));
    }
=========================
 which is rather late to call after webTarget is initialized in constructor.

The correct code should be:
=========================
void setUsernamePassword(String username, String password) {
        webTarget.register(new org.glassfish.jersey.client.filter.HttpBasicAuthFilter(username, password));
    }
=========================
May be, generate also another constructor with username, password parameters.
Comment 1 Milan Kuchtiak 2013-06-26 13:25:10 UTC
Fixed.
Comment 2 David Konecny 2013-06-26 21:16:37 UTC
I never tested any of the changes related to security and Jersey 2.0. Thanks. 

Btw. Milan it is a good practice to append into the issue hg changeset which resolved the issue. Some people even prefix it with repository they pushed the fix into, eg. web-main#123456789
Comment 3 Quality Engineering 2013-06-27 02:18:04 UTC
Integrated into 'main-golden', will be available in build *201306262301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1c9b7bb86457
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #231819 changes in Auth Basic Generator