public NpgsqlConsentStore(NpgsqlConnection conn, NpgsqlSchema schema) { Preconditions.IsNotNull(conn, nameof(conn)); Preconditions.IsShortString(schema, nameof(schema)); _conn = conn; _schema = schema; _loadAllQuery = "SELECT subject, client_id, scopes " + $"FROM {_schema}.consents " + "WHERE subject = @subject"; _revokeQuery = $"DELETE FROM {_schema}.consents " + "WHERE subject = @subject AND client_id = @client"; _loadQuery = "SELECT subject, client_id, scopes " + $"FROM {_schema}.consents " + "WHERE subject = @subject AND client_id = @client"; _rowExistsQuery = "SELECT COUNT(subject) " + $"FROM {_schema}.consents " + "WHERE subject = @subject AND client_id = @client"; _insertQuery = $"INSERT INTO {_schema}.consents(subject, client_id, scopes) " + "VALUES (@subject, @client, @scopes)"; _updateQuery = $"UPDATE {_schema}.consents " + "SET scopes = @scopes " + "WHERE subject = @subject AND client_id = @client"; }
public NpgsqlRefreshTokenStore(NpgsqlConnection conn, NpgsqlSchema schema, IScopeStore scopeStore, IClientStore clientStore) : base(conn, schema, TokenType.RefreshToken, scopeStore, clientStore) { _updateExpiryQuery = $"UPDATE {Schema}.tokens " + "SET expiry = @expiry " + "WHERE key = @key " + " AND token_type = @tokenType"; }
public NpgsqlClientStore(NpgsqlConnection conn, NpgsqlSchema schema) { Preconditions.IsNotNull(conn, nameof(conn)); Preconditions.IsShortString(schema, nameof(schema)); _conn = conn; _schema = schema; _serializer = JsonSerializerFactory.Create(); _findQuery = "SELECT client_id, model " + $"FROM {_schema}.clients " + "WHERE client_id = @client"; _insertQuery = $"INSERT INTO {_schema}.clients(client_id, model) " + "VALUES(@client, @model);"; }
public NpgsqlScopeStore(NpgsqlConnection conn, NpgsqlSchema schema) { Preconditions.IsNotNull(conn, nameof(conn)); Preconditions.IsShortString(schema, nameof(schema)); _serializer = JsonSerializerFactory.Create(); _conn = conn; _schema = schema; _findQuery = "SELECT name, is_public, model " + $"FROM {_schema}.scopes " + "WHERE name = any (@names)"; _getQuery = "SELECT name, is_public, model " + $"FROM {_schema}.scopes " + "WHERE is_public = @public"; }
protected BaseNpgsqlTokenStore(NpgsqlConnection conn, NpgsqlSchema schema, TokenType storedTokenType, IScopeStore scopeStore, IClientStore clientStore) { StoredTokenType = storedTokenType; Conn = conn; Schema = schema; _serializer = JsonSerializerFactory.Create(); _serializer.Converters.Add(new ClaimsPrincipalConverter()); _serializer.Converters.Add(new ClientConverter(clientStore)); _serializer.Converters.Add(new ScopeConverter(scopeStore)); _scopeStore = scopeStore; _clientStore = clientStore; // Queries _revokeQuery = $"DELETE FROM {Schema}.tokens " + "WHERE subject = @subject " + " AND client = @client " + " AND token_type = @tokenType"; _removeQuery = $"DELETE FROM {Schema}.tokens " + "WHERE key = @key " + " AND token_type = @tokenType"; _getQuery = $"SELECT * FROM {Schema}.tokens " + "WHERE key = @key " + " AND token_type = @tokenType"; _getAllQuery = $"SELECT * FROM {Schema}.tokens " + "WHERE subject = @subject " + " AND token_type = @tokenType"; _insertQuery = "INSERT INTO " + $"{Schema}.tokens(key, token_type, subject, client, expiry, model) " + "VALUES(@key, @token_type, @subject, @client, @expiry, @model); "; }
public NpgsqlTokenHandleStore(NpgsqlConnection conn, NpgsqlSchema schema, IScopeStore scopeStore, IClientStore clientStore) : base(conn, schema, TokenType.TokenHandle, scopeStore, clientStore) { }
public NpgsqlAuthorizationCodeStore(NpgsqlConnection conn, NpgsqlSchema schema, IScopeStore scopeStore, IClientStore clientStore) : base(conn, schema, TokenType.AuthorizationCode, scopeStore, clientStore) { }