karishma-tirthani / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

Basic Auth behavior doesn't work for create request #153

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create consumer with basic auth
2. execute create request

What is the expected output? What do you see instead?
create failed due authentication issue. there are no authentication data has 
been sent in post request.

What version of the product are you using? On what operating system?
0.6 cxf

Original issue reported on code.google.com by kisel.ev...@gmail.com on 27 Mar 2012 at 1:55

GoogleCodeExporter commented 8 years ago
it also doesn't work for all others request except requests to metadata.

Original comment by kisel.ev...@gmail.com on 10 Apr 2012 at 1:13

GoogleCodeExporter commented 8 years ago
Stephan, can you take a look?  Appears to be cxf only.

Original comment by john.spurlock on 22 Apr 2012 at 4:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by philipp.sebastian.thun on 26 Jun 2012 at 2:44

GoogleCodeExporter commented 8 years ago

Original comment by philipp.sebastian.thun on 9 Aug 2012 at 11:53

GoogleCodeExporter commented 8 years ago
It seems that this problem has already been fixed for release 0.7 - 
unintentionally ;-) The problematic code must have been removed during the 
refactoring of the consumer implementations. Nevertheless an automatic test 
will be added to the integration test suite.

Original comment by philipp.sebastian.thun on 22 Aug 2012 at 3:36

GoogleCodeExporter commented 8 years ago
sorry just to clarify: Will this be in 0.8 release? 

I am using 0.7 with BasicAuthenticationBehavior and it does not work. Thanks.

Original comment by vmuniga...@gmail.com on 22 Aug 2012 at 6:39

GoogleCodeExporter commented 8 years ago
Could you please provide more details on your scenario? I have tested the 0.7 
release - creating, getting, updating and deleting an entity worked fine for 
me. What is your request sequence?

Original comment by philipp.sebastian.thun on 22 Aug 2012 at 7:09

GoogleCodeExporter commented 8 years ago
Philipp, are you testing with CXF?

Original comment by john.spurlock on 22 Aug 2012 at 7:11

GoogleCodeExporter commented 8 years ago
I have created an automated test that runs both, Jersey and CXF. This test 
fails for CXF and release 0.6 - as mentioned in the original issue description. 
But running against release 0.7, I do not see any problems...

Original comment by philipp.sebastian.thun on 22 Aug 2012 at 7:17

GoogleCodeExporter commented 8 years ago
This is my first attempt using this and I am just doing a 'get':

Builder builder = ODataConsumers.newBuilder("SERVICEURL");
builder.setClientBehaviors(new BasicAuthenticationBehavior("Administrator", 
"password"));       
ODataConsumer c = builder.build();
List<OEntity> templates = 
c.getEntities("VirtualMachineTemplates").execute().toList();

I get 401. I verified the credentials using the browser. 

Original comment by vmuniga...@gmail.com on 22 Aug 2012 at 7:49

GoogleCodeExporter commented 8 years ago
I checked this again to find out since when basic authentication is working for 
the CXF consumer. With revision 98cb0df96c8c major parts of the CXF consumer 
implementation have been refactored. From this change on the ODataCxfConsumer 
passes all client behaviors on to the ODataCxfClient (in the constructor). 
Before that the client was recreated all the time and for most request types, 
no client behaviors where provided - that's the reason why basic authentication 
failed for them. So the conclusion is: basic authentication and all other 
(non-Jersey) client behaviors should be working for the CXF consumer in release 
0.7.

@vmuniganti: Are you using the CXF or the Jersey consumer? Is it your own 
server you are running against? If yes, can you trace the incoming requests to 
see if the authentication header is sent?

Original comment by philipp.sebastian.thun on 23 Aug 2012 at 11:34

GoogleCodeExporter commented 8 years ago
Yes, I am using local server and I tried both Jersey and CXF with basic 
authentication and it did not work. Although the request does have the 
"Authorization" header set correctly. I am not sure where the problem is: in 
our local IIS server configuration or the library. I am trying to figure how 
IIS can be configured to accept Basic authentication. I tried various things to 
no avail.

Original comment by vmuniga...@gmail.com on 23 Aug 2012 at 8:40

GoogleCodeExporter commented 8 years ago
Added an automated consumer test for basic authentication (revision 
526c8977e055). I've also checked this against a provider running on Tomcat - 
both Jersey and CXF consumer are working fine. Thus I will close this issue.

@vmuniganti: I would suggest that you use the odata4j-discuss group for 
follow-up questions. As your problem seems to be related to a specific server, 
there might be someone else who has some ideas on how to overcome this 
situation.

Original comment by philipp.sebastian.thun on 27 Aug 2012 at 12:58