Thread View: borland.public.cppbuilder.internet.socket
9 messages
9 total messages
Started by Chris Lawton
Mon, 28 Jan 2008 16:54
TIDWebDav
Author: Chris Lawton
Date: Mon, 28 Jan 2008 16:54
Date: Mon, 28 Jan 2008 16:54
14 lines
1574 bytes
1574 bytes
Can anyone tell me (ideally with some quick example code cos I'm a bit slow at this), how to add digest authentication to WebDav? We have a WebDav, and are using the Indy 10 libraries for IdWebDav. We can connect to a WebDav system without a password, but need to connect to one with digest authentication enabled on it. But we can only find example for basic authentication. How do we tell the libraries to use Digest, and then get the username and password into that digest authentication method? We are finding things that suggest we need to add a TIdAutheticationDigest object to the TIdWebDav object. But we seem to be going round in circles now. Any help would be gratefully received. Thank you very much Chris
Re: TIDWebDav
Author: Remy Lebeau (TeamB)
Date: Mon, 28 Jan 2008 17:22
Date: Mon, 28 Jan 2008 17:22
30 lines
1964 bytes
1964 bytes
"Chris Lawton" <chrisl@gemstv.co.uk> wrote in message
news:479e08de$1@newsgroups.borland.com...
> Can anyone tell me (ideally with some quick example code cos
> I'm a bit slow at this), how to add digest authentication to WebDav?
#include IdAuthenticationDigest.hpp into your code. Since you are in a C++
environment, you may also have to call RegisterAuthenticationMethod()
manually at program startup as well:
RegisterAuthenticationMethod("Digest",
__classid(TIdDigestAuthentication));
> How do we tell the libraries to use Digest
It does so automatically after TIdAuthenticationDigest has been registered.
> then get the username and password into that digest authentication method?
The same way you get username/password in any authentication - via the
Request->Username and Request->Password properties.
> We are finding things that suggest we need to add a TIdAutheticationDigest
> object to the TIdWebDav object.
Yes, that is exactly what is needed.
Gambit
Re: TIDWebDav
Author: Chris Lawton
Date: Mon, 28 Jan 2008 18:30
Date: Mon, 28 Jan 2008 18:30
52 lines
2584 bytes
2584 bytes
Thanks very much for this, we have now got to the point that we are just
unable to add TIdDigestAuthentication objecr to authentication property
for the request under the TIdWebDav object.
We cant create a new TIdDigestAuthentication object because it is an
abstract class, does that mean we need to create our own class based on
this?
We can now send a file using WebDav, but with authentication required on
the server we never get username or password sent to the server.
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:479e0f17@newsgroups.borland.com...
>
> "Chris Lawton" <chrisl@gemstv.co.uk> wrote in message
> news:479e08de$1@newsgroups.borland.com...
>
>> Can anyone tell me (ideally with some quick example code cos
>> I'm a bit slow at this), how to add digest authentication to WebDav?
>
> #include IdAuthenticationDigest.hpp into your code. Since you are in a
> C++ environment, you may also have to call RegisterAuthenticationMethod()
> manually at program startup as well:
>
> RegisterAuthenticationMethod("Digest",
> __classid(TIdDigestAuthentication));
>
>> How do we tell the libraries to use Digest
>
> It does so automatically after TIdAuthenticationDigest has been
> registered.
>
>> then get the username and password into that digest authentication
>> method?
>
> The same way you get username/password in any authentication - via the
> Request->Username and Request->Password properties.
>
>> We are finding things that suggest we need to add a
>> TIdAutheticationDigest
>> object to the TIdWebDav object.
>
> Yes, that is exactly what is needed.
>
>
> Gambit
>
Re: TIDWebDav
Author: Remy Lebeau (TeamB)
Date: Mon, 28 Jan 2008 20:11
Date: Mon, 28 Jan 2008 20:11
17 lines
1807 bytes
1807 bytes
"Chris Lawton" <chrisl@gemstv.co.uk> wrote in message news:479e1f3f$1@newsgroups.borland.com... > We cant create a new TIdDigestAuthentication object > because it is an abstract class It is not supposed to be. Looks like someone recently added an abstract KeepAlive() method to TIdAuthentication and did not override it in TIdDigestAuthentication, though they did in TIdBasicAuthentication and TIdNTLMAuthentication. I have no clue what that method is supposed to be for, as TIdHTTP and TIdWebDav do not use it at all. I also have no clue why it is abstract in TIdAuthentication instead of simply defaulting to False instead. I'll have to look into it. Gambit
Re: TIDWebDav
Author: Remy Lebeau (TeamB)
Date: Wed, 30 Jan 2008 06:38
Date: Wed, 30 Jan 2008 06:38
13 lines
1413 bytes
1413 bytes
"Chris Lawton" <chrisl@gemstv.co.uk> wrote in message news:479e1f3f$1@newsgroups.borland.com... > We cant create a new TIdDigestAuthentication object > because it is an abstract class Indy's source control is currently migrating to a new system, so I can't check in any code at the moment, but I have fixed the problem in my local copy and will merge it in when source control is running again. Gambit
Re: TIDWebDav
Author: Chris Lawton
Date: Wed, 30 Jan 2008 10:02
Date: Wed, 30 Jan 2008 10:02
15 lines
1710 bytes
1710 bytes
Thanks very much for this, we have now managed to add the class TIdDigestAuthentication to the TIdWebDav. But we are still having problems setting the userid and password for the authentication in the base class. So any calls making use of DigestAuthentication have no access to username or password. We have tried setting TIdWebDav->Request->Username and TIdWebDav->Request->Authentication->Username and we have also tried to set the string in the base class directly (and the respective passwords), but still have no authentication infomation passed to the server. What are we doing wrong? Thank you Chris
Re: TIDWebDav
Author: Remy Lebeau (TeamB)
Date: Wed, 30 Jan 2008 17:57
Date: Wed, 30 Jan 2008 17:57
30 lines
2437 bytes
2437 bytes
"Chris Lawton" <chrisl@gemstv.co.uk> wrote in message news:47a04bac$1@newsgroups.borland.com... > But we are still having problems setting the userid and password > for the authentication in the base class. You are not supposed to be setting them in the Authentication class directly. Set them in TIdWebDav's Request property only, and they will be copied into the Authentication class internally when needed. > We have tried setting TIdWebDav->Request->Username That is the way to go. > still have no authentication infomation passed to the server. Then the server is likely not asking for Digest authentication to begin with. When a request requires credentials, the server returns a 401 response back, specifying the authentication schemes that the server supports. What values are actually being reported in the TIdWebDav->Response->WWWAuthenticate property? TIdHTTP/TIdWebDav uses that property to look in the list of registered TIdAuthentication-derived classes to find matches. If a match is found, the OnSelectAuthorization and OnAuthorization events are triggered and the original request is tried again with the new credentials. Otherwise, TIdHTTP/TIdWebDav aborts the request and returns an error to the calling application. Gambit
Re: TIDWebDav
Author: Chris Lawton
Date: Fri, 01 Feb 2008 18:21
Date: Fri, 01 Feb 2008 18:21
15 lines
1843 bytes
1843 bytes
I've even packet sniffed this now, to see exaclty what the coversation between the program and the server is. The client sends it's request, the server replies with: HTTP/1.1 401 Authorization Required Date: Fri, 01 Feb 2008 18:19:44 GMT Server: Apache/2.2.6 (Unix) mod_ssl/2.2.6 DAV/2 mod_jk/1.2.15 PHP/5.2.0 WWW-Authenticate: Digest realm="DAV", nonce="XrKc0RxFBAA=424b7854b5b4a9c3540d59888dcae7c55bcef233", algorithm=MD5, qop="auth" Content-Length: 401 Content-Type: text/html; charset=iso-8859-1 End of coversation. We just can't get it to do anything else. It wont send any authentication strings to the server. But we can log in via IE and windows network folder
Re: TIDWebDav
Author: Remy Lebeau (TeamB)
Date: Fri, 01 Feb 2008 18:47
Date: Fri, 01 Feb 2008 18:47
23 lines
1841 bytes
1841 bytes
"Chris Lawton" <chrisl@gemstv.co.uk> wrote in message news:47a3632e@newsgroups.borland.com... > I've even packet sniffed this now, to see exaclty what the > coversation between the program and the server is. The > client sends it's request, the server replies with: <snip> > End of coversation. > We just can't get it to do anything else. It wont send any > authentication strings to the server. Referring back to my earlier reply - are the OnSelectAuthorization and OnAuthorization events being triggered at all? Do you have the hoInProcessAuth flag enabled in the TIdHTTP.Options property? What are the TIdHTTP's AuthRetries and MaxAuthRetries properties set to when the reply is received? Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads