- Timestamp:
- Sep 7, 2018 2:56:38 AM (6 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_auth_msg.h
r3553 r5883 90 90 91 91 /** 92 * This structure describe credential used in Authorization and 93 * Proxy-Authorization header for OAuth authentication scheme. 94 */ 95 struct pjsip_oauth_credential 96 { 97 pj_str_t realm; /**< Realm of the credential */ 98 pjsip_param other_param; /**< Other parameters. */ 99 pj_str_t username; /**< Username parameter. */ 100 pj_str_t token; /**< Token parameter. */ 101 }; 102 103 /** 104 * @see pjsip_oauth_credential 105 */ 106 typedef struct pjsip_oauth_credential pjsip_oauth_credential; 107 108 /** 92 109 * This structure describes SIP Authorization header (and also SIP 93 110 * Proxy-Authorization header). … … 107 124 pjsip_digest_credential digest; /**< Digest credentials. */ 108 125 pjsip_pgp_credential pgp; /**< PGP credentials. */ 126 pjsip_oauth_credential oauth; /**< OAuth credentials. */ 109 127 } credential; 110 128 }; -
pjproject/trunk/pjsip/include/pjsip/sip_auth_parser.h
r3553 r5883 65 65 pjsip_DIGEST_STR, /**< "digest" string const. */ 66 66 pjsip_PGP_STR, /**< "pgp" string const. */ 67 pjsip_BEARER_STR, /**< "bearer" string const. */ 67 68 pjsip_MD5_STR, /**< "md5" string const. */ 68 69 pjsip_AUTH_STR; /**< "auth" string const. */ -
pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c
r5575 r5883 960 960 hs = pjsip_authorization_hdr_create(tdata->pool); 961 961 pj_strdup(tdata->pool, &hs->scheme, &c->scheme); 962 pj_strdup(tdata->pool, &hs->credential.digest.username, 963 &c->username); 964 pj_strdup(tdata->pool, &hs->credential.digest.realm, 965 &c->realm); 966 pj_strdup(tdata->pool, &hs->credential.digest.uri, &uri); 967 pj_strdup(tdata->pool, &hs->credential.digest.algorithm, 968 &sess->pref.algorithm); 962 if (pj_stricmp(&c->scheme, &pjsip_BEARER_STR)==0) { 963 pj_strdup(tdata->pool, &hs->credential.oauth.username, 964 &c->username); 965 pj_strdup(tdata->pool, &hs->credential.oauth.realm, 966 &c->realm); 967 pj_strdup(tdata->pool, &hs->credential.oauth.token, 968 &c->data); 969 } else { //if (pj_stricmp(&c->scheme, &pjsip_DIGEST_STR)==0) 970 pj_strdup(tdata->pool, &hs->credential.digest.username, 971 &c->username); 972 pj_strdup(tdata->pool, &hs->credential.digest.realm, 973 &c->realm); 974 pj_strdup(tdata->pool,&hs->credential.digest.uri, &uri); 975 pj_strdup(tdata->pool, &hs->credential.digest.algorithm, 976 &sess->pref.algorithm); 977 } 969 978 970 979 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hs); -
pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c
r5809 r5883 104 104 } 105 105 106 static int print_oauth_credential(pjsip_oauth_credential *cred, char *buf, 107 pj_size_t size) 108 { 109 pj_ssize_t printed; 110 char *startbuf = buf; 111 char *endbuf = buf + size; 112 113 copy_advance_pair_quote_cond_always(buf, "token=", 6, cred->token, 114 '"', '"'); 115 copy_advance_pair_quote_cond_always(buf, ", username=", 11, cred->username, 116 '"', '"'); 117 copy_advance_pair_quote_cond_always(buf, ", realm=", 8, cred->realm, 118 '"', '"'); 119 120 return (int) (buf-startbuf); 121 } 122 106 123 static int pjsip_authorization_hdr_print( pjsip_authorization_hdr *hdr, 107 124 char *buf, pj_size_t size) … … 126 143 printed = print_pgp_credential(&hdr->credential.pgp, buf, endbuf - buf); 127 144 } 145 else if (pj_stricmp(&hdr->scheme, &pjsip_BEARER_STR) == 0) 146 { 147 printed = print_oauth_credential(&hdr->credential.oauth, buf, 148 endbuf - buf); 149 } 128 150 else { 129 151 pj_assert(0); -
pjproject/trunk/pjsip/src/pjsip/sip_auth_parser.c
r4859 r5883 60 60 pjsip_PGP_STR = { "PGP", 3 }, 61 61 pjsip_QUOTED_PGP_STR = { "\"PGP\"", 5 }, 62 pjsip_BEARER_STR = { "Bearer", 6 }, 62 63 pjsip_MD5_STR = { "md5", 3 }, 63 64 pjsip_QUOTED_MD5_STR = { "\"md5\"", 5},
Note: See TracChangeset
for help on using the changeset viewer.