Add support for IMS AKA authentication configuration

This commit is contained in:
Andreas Eversberg 2024-04-24 19:44:12 +02:00
parent 1e09653a76
commit 42ccbf1598
3 changed files with 8 additions and 4 deletions

View File

@ -580,6 +580,9 @@ struct ast_sip_auth {
AST_STRING_FIELD(auth_user);
/*! Authentication password */
AST_STRING_FIELD(auth_pass);
/*! IMS Authentication password */
char ims_res[8];
int ims_res_len;
/*! Authentication credentials in MD5 format (hash of user:realm:pass) */
AST_STRING_FIELD(md5_creds);
/*! Refresh token to use for OAuth authentication */
@ -591,7 +594,6 @@ struct ast_sip_auth {
/*! Use USIM emulation with these parameters */
AST_STRING_FIELD(usim_opc);
AST_STRING_FIELD(usim_k);
AST_STRING_FIELD(usim_amf);
AST_STRING_FIELD(usim_sqn);
);
/*! Use AMI interface for communication with USIM (instead of emulation) */

View File

@ -405,8 +405,6 @@ int ast_sip_initialize_sorcery_auth(void)
"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, usim_opc));
ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "usim_k",
"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, usim_k));
ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "usim_amf",
"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, usim_amf));
ast_sorcery_object_field_register(sorcery, SIP_SORCERY_AUTH_TYPE, "usim_sqn",
"", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, usim_sqn));
ast_sorcery_object_field_register_custom(sorcery, SIP_SORCERY_AUTH_TYPE, "auth_type",

View File

@ -313,10 +313,14 @@ static pj_status_t set_outbound_authentication_credentials(pjsip_auth_clt_sess *
pj_cstr(&auth_cred.scheme, "digest");
switch (auth->type) {
case AST_SIP_AUTH_TYPE_USER_PASS:
case AST_SIP_AUTH_TYPE_IMS_AKA:
pj_cstr(&auth_cred.data, auth->auth_pass);
auth_cred.data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
break;
case AST_SIP_AUTH_TYPE_IMS_AKA:
auth_cred.data.ptr = auth->ims_res;
auth_cred.data.slen = auth->ims_res_len;
auth_cred.data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
break;
case AST_SIP_AUTH_TYPE_MD5:
pj_cstr(&auth_cred.data, auth->md5_creds);
auth_cred.data_type = PJSIP_CRED_DATA_DIGEST;