aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-session.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-11-15 16:21:03 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2019-11-29 12:48:17 +0100
commitb4da3b7f3db2211e7ecca74301e26b3089fda5a2 (patch)
treedaa23ed28c907b563c3bb13a246a1b0b1de5ca74 /src/afb-session.c
parente08d57c0e397018f0c463a66adc232f6358caef5 (diff)
Move tokens from sessions to requests
Tokens are no more related to sessions. Each request provides a token. In the case of websockets or connected link, the context can record the token. Bug-AGL: SPEC-2968 Change-Id: I1442b0422584c5a5b860ddb826518b0e673612f9 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-session.c')
-rw-r--r--src/afb-session.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/afb-session.c b/src/afb-session.c
index bb10c2cb..3e267fd2 100644
--- a/src/afb-session.c
+++ b/src/afb-session.c
@@ -61,15 +61,14 @@ struct afb_session
struct afb_session *next; /**< link to the next */
unsigned refcount; /**< count of reference to the session */
int timeout; /**< timeout of the session */
- time_t expiration; /**< expiration time of the token */
+ time_t expiration; /**< expiration time of the session */
pthread_mutex_t mutex; /**< mutex of the session */
struct cookie *cookies[COOKIECOUNT]; /**< cookies of the session */
char *lang; /**< current language setting for the session */
uint8_t closed: 1; /**< is the session closed ? */
uint8_t autoclose: 1; /**< close the session when unreferenced */
uint8_t notinset: 1; /**< session removed from the set of sessions */
- uuid_stringz_t uuid; /**< long term authentication of remote client */
- struct afb_token *token;/**< short term authentication of remote client */
+ uuid_stringz_t uuid; /**< indentification of client seesion */
};
/**
@@ -204,7 +203,6 @@ static void session_destroy (struct afb_session *session)
afb_hook_session_destroy(session);
#endif
pthread_mutex_destroy(&session->mutex);
- afb_token_unref(session->token);
free(session->lang);
free(session);
}
@@ -251,13 +249,11 @@ static struct afb_session *session_add(const char *uuid, int timeout, time_t now
pthread_mutex_init(&session->mutex, NULL);
session->refcount = 1;
strcpy(session->uuid, uuid);
- session->token = afb_token_addref(sessions.initok);
session->timeout = timeout;
session_update_expiration(session, now);
/* add */
if (sessionset_add(session, hashidx)) {
- afb_token_unref(session->token);
free(session);
return NULL;
}
@@ -308,7 +304,6 @@ static time_t sessionset_cleanup (int force)
* @param max_session_count maximum allowed session count in the same time
* @param timeout the initial default timeout of sessions
* @param initok the initial default token of sessions
- *
*/
int afb_session_init (int max_session_count, int timeout, const char *initok)
{
@@ -529,22 +524,6 @@ int afb_session_is_closed (struct afb_session *session)
return session->closed;
}
-/*
- * check whether the token of 'session' is 'token'
- * return 1 if true or 0 otherwise
- */
-int afb_session_check_token (struct afb_session *session, const char *token)
-{
- int r;
-
- session_lock(session);
- r = !session->closed
- && session->expiration >= NOW
- && !(session->token && strcmp(token, afb_token_string(session->token)));
- session_unlock(session);
- return r;
-}
-
/* Returns the uuid of 'session' */
const char *afb_session_uuid (struct afb_session *session)
{