cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-3511) Add support for creating WebClient with basic authentication credentials for non-Spring usecase
Date Wed, 11 May 2011 17:53:48 GMT

    [ https://issues.apache.org/jira/browse/CXF-3511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031890#comment-13031890
] 

Sergey Beryozkin commented on CXF-3511:
---------------------------------------

Hi, 

WebClient.create(baseAddress, username, password, null)

can be used right now if no Spring config is used which is realistically needed to enable
HTTPS

> Add support for creating WebClient with basic authentication credentials for non-Spring
usecase
> -----------------------------------------------------------------------------------------------
>
>                 Key: CXF-3511
>                 URL: https://issues.apache.org/jira/browse/CXF-3511
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.4
>            Reporter: Arul Dhesiaseelan
>            Priority: Minor
>
> I create a JAX-RS server programmatically without using Spring and an authentication
handler set:
>     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>     sf.setResourceClasses(Resource.class);
>     sf.setResourceProvider(Resource.class, new SingletonResourceProvider(new Resource()));
>     sf.setAddress("http://localhost:9000/hello");
>     sf.getOutInterceptors().add(new LoggingOutInterceptor());
>     sf.getInInterceptors().add(new LoggingInInterceptor());
>     sf.setProvider(new AuthenticationHandler());
> On, the client side (WebClient), there is no helper method that allows me to set basic
authentication credentials for non-Spring use. I can have the static method in my code, but
I thought it would be handy to have it in WebClient. Here is the utility method:
>     /**
>      * Creates WebClient which will do basic authentication
>      * @param baseAddress baseAddress
>      * @param username username
>      * @param password password
>      * @return WebClient instance
>      */
>     public static WebClient create(String baseAddress, String username, String password)
{
>         JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
>         bean.setAddress(baseAddress);        
>         bean.setUsername(username);
>         bean.setPassword(password);        
>         return bean.createWebClient();
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message