Beispiel #1
0
func saveLoginTokenToContext(context *ipv4.ServiceContext, token string) error {
	// unique is a string identifier which should be locally unique for services
	// TODO: replace with better unique identifier than IP, if one is available
	unique := context.IP.String()
	key := tokenKey(unique)
	return context.StoreData(key, token)
}
Beispiel #2
0
func getLoginTokenFromContext(context *ipv4.ServiceContext) string {
	// unique is a string identifier which should be locally unique for services
	// TODO: replace with better unique identifier than IP, if one is available
	unique := context.IP.String()
	key := tokenKey(unique)
	token, err := context.GetData(key)
	if err != nil {
		Log.Warn("could not get token from context", "err", err, "token_key", key, "context", context)
		return ""
	}
	return token
}
Beispiel #3
0
func getUUIDFromContext(context *ipv4.ServiceContext) string {
	// unique is a string identifier which should be locally unique for services
	// TODO: replace with better unique identifier than IP, if one is available
	unique := context.IP.String()
	key := uuidKey(unique)
	uuid, err := context.GetData(key) // get the UUID
	if err != nil {
		Log.Warn("could not get UUID from context", "err", err, "uuid_key", key, "context", context)
		return ""
	}
	return uuid
}