working on oauth
This commit is contained in:
parent
76b5527c33
commit
0cace2dcea
@ -378,7 +378,8 @@ static void auth_server_receive_message(struct bufferevent *bev, void *ptr)
|
||||
|
||||
if(am.ct == TURN_CREDENTIALS_SHORT_TERM) {
|
||||
st_password_t pwd;
|
||||
am.oauth = 0;
|
||||
am.in_oauth = 0;
|
||||
am.out_oauth = 0;
|
||||
if(get_user_pwd(am.username,pwd)<0) {
|
||||
am.success = 0;
|
||||
} else {
|
||||
@ -387,7 +388,7 @@ static void auth_server_receive_message(struct bufferevent *bev, void *ptr)
|
||||
}
|
||||
} else {
|
||||
hmackey_t key;
|
||||
if(get_user_key(am.oauth,&(am.oauth),am.username,am.realm,key,am.in_buffer.nbh)<0) {
|
||||
if(get_user_key(am.in_oauth,&(am.out_oauth),am.username,am.realm,key,am.in_buffer.nbh)<0) {
|
||||
am.success = 0;
|
||||
} else {
|
||||
ns_bcopy(key,am.key,sizeof(hmackey_t));
|
||||
@ -769,7 +770,7 @@ static int handle_relay_message(relay_server_handle rs, struct message_to_relay
|
||||
|
||||
static void handle_relay_auth_message(struct relay_server *rs, struct auth_message *am)
|
||||
{
|
||||
am->resume_func(am->success, am->oauth, am->key, am->pwd,
|
||||
am->resume_func(am->success, am->out_oauth, am->key, am->pwd,
|
||||
&(rs->server), am->ctxkey, &(am->in_buffer));
|
||||
if (am->in_buffer.nbh) {
|
||||
ioa_network_buffer_delete(rs->ioa_eng, am->in_buffer.nbh);
|
||||
|
||||
@ -404,8 +404,6 @@ int get_user_key(int in_oauth, int *out_oauth, u08bits *usname, u08bits *realm,
|
||||
|
||||
if(in_oauth && out_oauth && usname && usname[0] && realm && realm[0]) {
|
||||
|
||||
*out_oauth = 0;
|
||||
|
||||
stun_attr_ref sar = stun_attr_get_first_by_type_str(ioa_network_buffer_data(nbh),
|
||||
ioa_network_buffer_get_size(nbh),
|
||||
STUN_ATTRIBUTE_OAUTH_ACCESS_TOKEN);
|
||||
@ -627,7 +625,7 @@ int get_user_pwd(u08bits *usname, st_password_t pwd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int oauth, u08bits *usname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply)
|
||||
u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int in_oauth, int *out_oauth, u08bits *usname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply)
|
||||
{
|
||||
*postpone_reply = 1;
|
||||
|
||||
@ -635,7 +633,8 @@ u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int oauth,
|
||||
ns_bzero(&am,sizeof(struct auth_message));
|
||||
am.id = id;
|
||||
am.ct = ct;
|
||||
am.oauth = oauth;
|
||||
am.in_oauth = in_oauth;
|
||||
am.out_oauth = *out_oauth;
|
||||
STRCPY(am.username,usname);
|
||||
STRCPY(am.realm,realm);
|
||||
am.resume_func = resume;
|
||||
|
||||
@ -86,7 +86,8 @@ void update_o_to_realm(ur_string_map * o_to_realm_new);
|
||||
struct auth_message {
|
||||
turnserver_id id;
|
||||
turn_credential_type ct;
|
||||
int oauth;
|
||||
int in_oauth;
|
||||
int out_oauth;
|
||||
u08bits username[STUN_MAX_USERNAME_SIZE + 1];
|
||||
u08bits realm[STUN_MAX_REALM_SIZE + 1];
|
||||
hmackey_t key;
|
||||
@ -190,7 +191,7 @@ void add_to_secrets_list(secrets_list_t *sl, const char* elem);
|
||||
|
||||
int get_user_key(int in_oauth, int *out_oauth, u08bits *uname, u08bits *realm, hmackey_t key, ioa_network_buffer_handle nbh);
|
||||
int get_user_pwd(u08bits *uname, st_password_t pwd);
|
||||
u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int oauth, u08bits *uname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply);
|
||||
u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int in_oauth, int *out_oauth, u08bits *uname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply);
|
||||
int check_new_allocation_quota(u08bits *username, u08bits *realm);
|
||||
void release_allocation_quota(u08bits *username, u08bits *realm);
|
||||
|
||||
|
||||
@ -3315,7 +3315,7 @@ static int check_stun_auth(turn_turnserver *server,
|
||||
/* Password */
|
||||
if(!(ss->hmackey_set) && (ss->pwd[0] == 0)) {
|
||||
if(can_resume) {
|
||||
(server->userkeycb)(server->id, server->ct, server->oauth, usname, realm, resume_processing_after_username_check, in_buffer, ss->id, postpone_reply);
|
||||
(server->userkeycb)(server->id, server->ct, server->oauth, &(ss->oauth), usname, realm, resume_processing_after_username_check, in_buffer, ss->id, postpone_reply);
|
||||
if(*postpone_reply) {
|
||||
return 0;
|
||||
}
|
||||
@ -3357,7 +3357,7 @@ static int check_stun_auth(turn_turnserver *server,
|
||||
}
|
||||
|
||||
if(can_resume) {
|
||||
(server->userkeycb)(server->id, server->ct, server->oauth, usname, realm, resume_processing_after_username_check, in_buffer, ss->id, postpone_reply);
|
||||
(server->userkeycb)(server->id, server->ct, server->oauth, &(ss->oauth), usname, realm, resume_processing_after_username_check, in_buffer, ss->id, postpone_reply);
|
||||
if(*postpone_reply) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ struct _turn_turnserver;
|
||||
typedef struct _turn_turnserver turn_turnserver;
|
||||
|
||||
typedef void (*get_username_resume_cb)(int success, int oauth, hmackey_t hmackey, st_password_t pwd, turn_turnserver *server, u64bits ctxkey, ioa_net_data *in_buffer);
|
||||
typedef u08bits *(*get_user_key_cb)(turnserver_id id, turn_credential_type ct, int oauth, u08bits *uname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply);
|
||||
typedef u08bits *(*get_user_key_cb)(turnserver_id id, turn_credential_type ct, int in_oauth, int *out_oauth, u08bits *uname, u08bits *realm, get_username_resume_cb resume, ioa_net_data *in_buffer, u64bits ctxkey, int *postpone_reply);
|
||||
typedef int (*check_new_allocation_quota_cb)(u08bits *username, u08bits *realm);
|
||||
typedef void (*release_allocation_quota_cb)(u08bits *username, u08bits *realm);
|
||||
typedef int (*send_socket_to_relay_cb)(turnserver_id id, u64bits cid, stun_tid *tid, ioa_socket_handle s, int message_integrity, MESSAGE_TO_RELAY_TYPE rmt, ioa_net_data *nd, int can_resume);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user