Document authentication changes

This commit is contained in:
Tobias Taschner 2018-10-25 23:02:23 +02:00
parent 5f3dc058aa
commit 1a34f3dab9
No known key found for this signature in database
GPG Key ID: AE6ECD71294F87FD

View File

@ -131,21 +131,11 @@ public:
State_Active,
/**
The server denied the request because of insufficient
user credentials. When credentials are provided with
SetCredentials() the request will be retried with the supplied
user credentials.
The request is currently unauthorized. Calling GetAuthChallenge()
returns a challenge object with further details.
*/
State_Unauthorized,
/**
A proxy denied the request because of insufficient
user credentials. When credentials are provided with
SetCredentials() the request will be retried with the supplied
user credentials.
*/
State_UnauthorizedProxy,
/// The request completed successfully and all data has been received.
State_Completed,
@ -174,16 +164,6 @@ public:
Storage_None
};
/// Possible credential targets used by SetCredentials().
enum CredentialTarget
{
/// Set credentials to be sent to the server.
CredentialTarget_Server,
/// Set credentials to be sent to a proxy.
CredentialTarget_Proxy
}
/**
Sets a request header which will be sent to the server by this request.
@ -247,19 +227,11 @@ public:
const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset);
/**
Sets the credentials to be sent to the server or proxy when
authentification is requested.
@param user
User name
@param password
Password
@param target
Specify the credentials for the server @c CredentialTarget_Server
or the proxy @c CredentialTarget_Proxy.
Returns the current authentication challenge object while the request
is in @c State_Unauthorized.
*/
void SetCredentials(const wxString& user, const wxString& password,
CredentialTarget target);
wxWebAuthChallenge* GetAuthChallenge();
/**
Instructs the request to ignore server error status codes.
@ -330,6 +302,26 @@ public:
State GetState() const { return m_state; }
};
/**
Authentication challenge information available via
wxWebRequest::GetAuthChallenge().
Use SetCredentials() to provide user credentials.
*/
class wxWebAuthChallenge
{
public:
/**
Used to provide user credentials to the authentication challenge.
@param user
User name.
@param password
The users password.
*/
void SetCredentials(const wxString& user, const wxString& password);
};
/**
A wxWebResponse allows access to the response sent by the server.