Osip_www_authenticate_t struct stores information parameters of the www_authenticate header field
Is the authentication information sent by the server to the client 401 data packets. The purpose is to send the authentication information to the client
After calculation, a verification result is sent.
It mainly includes nonce and realm fields.
The osip_authorization_t struct stores information parameters of the Authorization Header domain.
It is the authentication feedback sent by the client to the server. The purpose is to verify the client's
Legitimacy
It mainly includes the following fields:
Nonce realm URI username method Algorithm
The following are two struct definitions:
Typedef struct osip_authorization osip_authorization_t;
/**
* Definition of the Authorization header.
* @ Struct osip_authorization
*/
Struct osip_authorization
{
Char * auth_type;/** <authentication type (basic or Digest )*/
Char * username;/** <login */
Char * realm;/** <realm (as a quoted-string )*/
Char * nonce;/** <nonce */
Char * URI;/** <URI */
Char * response;/** <response */
Char * digest;/** <digest */
Char * algorithm;/** <algorithm (optionnal )*/
Char * cnonce;/** <cnonce (optionnal )*/
Char * opaque;/** <opaque (optionnal )*/
Char * message_qop;/** <message_qop (optionnal )*/
Char * nonce_count;/** <nonce_count (optionnal )*/
Char * auth_param;/** <other parameters (optionnal )*/
};
/**
* Structure for WWW-authenticate headers.
* @ Var osip_www_authenticate_t
*/
Typedef struct osip_www_authenticate osip_www_authenticate_t;
/**
* Definition of the WWW-Authenticate header.
* @ Struct osip_www_authenticate
*/
Struct osip_www_authenticate
{
Char * auth_type;/** <authentication type (basic or digest */
Char * realm;/** <realm (as a quoted-string )*/
Char * domain;/** <domain (optional )*/
Char * nonce;/** <nonce (optional )*/
Char * opaque;/** <opaque (optional )*/
Char * stale;/** <stale (optional )*/
Char * algorithm;/** <algorythm (optional )*/
Char * qop_options;/** <qop option (optional )*/
Char * auth_param;/** <other parameters (optional )*/
};
Extended questions: what exactly does nextnnonce, qop_options, cnonce, and noncecount refer,
What does the client hide?
Int
Osip_authentication_info_init (osip_authentication_info_t ** DEST)
{
* DEST =
(Osip_authentication_info_t *)
Osip_malloc (sizeof (osip_authentication_info_t ));
If (* DEST = NULL)
Return osip_nomem;
(* DEST)-> nextnonce = NULL;
(* DEST)-> qop_options = NULL;
(* DEST)-> rspauth = NULL;
(* DEST)-> cnonce = NULL;
(* DEST)-> nonce_count = NULL;
Return osip_success;
}
Int
Osip_authorization_init (osip_authorization_t ** DEST)
{
* DEST = (osip_authorization_t *) osip_malloc (sizeof (osip_authorization_t ));
If (* DEST = NULL)
Return osip_nomem;
(* DEST)-> auth_type = NULL;
(* DEST)-> username = NULL;
(* DEST)-> realm = NULL;
(* DEST)-> nonce = NULL;
(* DEST)-> uri = NULL;
(* DEST)-> response = NULL;
(* DEST)-> digest = NULL;/* do not use it in authorization_t header ?? */
(* DEST)-> algorithm = NULL;/* optionnal, default is "MD5 "*/
(* DEST)-> cnonce = NULL;/* optionnal */
(* DEST)-> opaque = NULL;/* optionnal */
(* DEST)-> message_qop = NULL;/* optionnal */
(* DEST)-> nonce_count = NULL;/* optionnal */
(* DEST)-> auth_param = NULL;/* for other headers -- not implemented --*/
Return osip_success;
}