Ejemplo n.º 1
0
        public async Task <UserInfo> FindByNameAsync(string normalizedUserName, CancellationToken cancellationToken)
        {
            var result = await _dynamoDb.QueryAsync(FindByNameQuery(normalizedUserName), cancellationToken);

            var record = result.Items.FirstOrDefault();

            if (record == null)
            {
                return(null);
            }

            return(UserModelFactory.CreateUserInfoFromAWS(record));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves an application using its unique identifier.
        /// </summary>
        /// <param name="identifier">The unique identifier associated with the application.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
        /// <returns>
        /// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
        /// whose result returns the client application corresponding to the identifier.
        /// </returns>
        public virtual async Task <OpenIddictApplication> FindByIdAsync(string identifier, CancellationToken cancellationToken)
        {
            var result = await _dynamoDb.QueryAsync(new QueryRequest
            {
                TableName = "OpenIdApplication",
                KeyConditionExpression    = "Id = :v_Id",
                ExpressionAttributeValues = new Dictionary <string, AttributeValue> {
                    { ":v_Id", new AttributeValue {
                          S = identifier
                      } }
                }
            }, cancellationToken);

            var record = result.Items.FirstOrDefault();

            return(OpenIdModelFactory.CreateApplicationFromAWS(record));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieves an token using its unique identifier.
        /// </summary>
        /// <param name="identifier">The unique identifier associated with the token.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
        /// <returns>
        /// A <see cref="Task"/> that can be used to monitor the asynchronous operation,
        /// whose result returns the token corresponding to the unique identifier.
        /// </returns>
        public virtual async Task <OpenIddictToken> FindByIdAsync(string identifier, CancellationToken cancellationToken)
        {
            var key = ConvertIdentifierFromString(identifier);

            var result = await _dynamoDb.QueryAsync(new QueryRequest
            {
                TableName = TableName,
                KeyConditionExpression    = "Id = :v_Id",
                ExpressionAttributeValues = new Dictionary <string, AttributeValue> {
                    { ":v_Id", new AttributeValue {
                          S = key
                      } }
                },
            }, cancellationToken);

            var record = result.Items.FirstOrDefault();

            return(record != null?OpenIdModelFactory.CreateTokenFromAWS(record) : null);
        }