MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / GetUserID

Function GetUserID

src/internal/authentication/authentication.go:278–299  ·  view source on GitHub ↗

GetUserID : get user ID

(token string)

Source from the content-addressed store, hash-verified

276
277// GetUserID : get user ID
278func GetUserID(token string) (userID string, err error) {
279
280 err = checkInit()
281 if err != nil {
282 return
283 }
284
285 err = createError(002)
286
287 if v, ok := tokens[token]; ok {
288 var expires = v.(map[string]interface{})["expires"].(time.Time)
289 userID = v.(map[string]interface{})["id"].(string)
290
291 if expires.Sub(time.Now().Local()) < 0 {
292 return
293 }
294
295 err = nil
296 }
297
298 return
299}
300
301// WriteUserData : save user date
302func WriteUserData(userID string, userData map[string]interface{}) (err error) {

Callers 2

checkAuthorizationLevelFunction · 0.92

Calls 2

checkInitFunction · 0.85
createErrorFunction · 0.85

Tested by

no test coverage detected