Exemple #1
0
    public async ValueTask <string?> ValidateToken([FromBody] TokenData tokenData)
    {
        var token = tokenData.token;

        // We cannot pop it as multiple requests are going on for the same token when negotiating SignalR connection.
        var value = await _cache.GetValueAsync(token)
                    .ConfigureAwait(false);

        if (string.IsNullOrEmpty(value))
        {
            return(null);
        }

        // We cannot do this because this is scoped to Service tokens as of now.

        /*if (ProfileId.Value != value.Trim('"').Split('$')[0])
         *  return null;*/

        // TODO: Validate token.

        return(value.Trim('"').Split('$')[1]);
    }
 public static ValueTask <string?> GetValueAsync(this ITyrCache cache, string key)
 => cache.GetValueAsync <string>(key);