mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[PM-5645] Cosmos DB Grant Storage (#3634)
* table storage grants * simple shard on storage accounts * use is not * cosmos grant repo * remove single storage connection string * some fixes to dapper grant repo * pattern matching * add fallback to base PersistedGrantStore * service collection extension cleanup * cleanup * remove unused Id * empty string rowkey * fix sharding method logic * ttl for cosmos * make ttl an int * fixes to cosmos implementation * fix partition key values * catch notfound exceptions * indenting * update grantitem with custom serialization * use new transform helpers * grantloader perf test tool * ref * remove grant loader project * remove table storage implementation * remove table storage stuff * all redis fallback to build to null * revert sln file change * EOF new line * remove trailing comma * lint fixes * add grant to names * move cosmos serilaizer to utils * add some .net 8 keyed service comments * EnableContentResponseOnWrite * Fix type in EF grant repository
This commit is contained in:
@ -13,8 +13,11 @@ public class RedisPersistedGrantStoreTests
|
||||
{
|
||||
const string SQL = nameof(SQL);
|
||||
const string Redis = nameof(Redis);
|
||||
const string Cosmos = nameof(Cosmos);
|
||||
|
||||
private readonly IPersistedGrantStore _redisGrantStore;
|
||||
private readonly IPersistedGrantStore _sqlGrantStore;
|
||||
private readonly IPersistedGrantStore _cosmosGrantStore;
|
||||
private readonly PersistedGrant _updateGrant;
|
||||
|
||||
private IPersistedGrantStore _grantStore = null!;
|
||||
@ -45,12 +48,18 @@ public class RedisPersistedGrantStoreTests
|
||||
);
|
||||
|
||||
var sqlConnectionString = "YOUR CONNECTION STRING HERE";
|
||||
|
||||
_sqlGrantStore = new PersistedGrantStore(
|
||||
new GrantRepository(
|
||||
sqlConnectionString,
|
||||
sqlConnectionString
|
||||
)
|
||||
),
|
||||
g => new Bit.Core.Auth.Entities.Grant(g)
|
||||
);
|
||||
|
||||
var cosmosConnectionString = "YOUR CONNECTION STRING HERE";
|
||||
_cosmosGrantStore = new PersistedGrantStore(
|
||||
new Bit.Core.Auth.Repositories.Cosmos.GrantRepository(cosmosConnectionString),
|
||||
g => new Bit.Core.Auth.Models.Data.GrantItem(g)
|
||||
);
|
||||
|
||||
var creationTime = new DateTime(638350407400000000, DateTimeKind.Utc);
|
||||
@ -69,7 +78,7 @@ public class RedisPersistedGrantStoreTests
|
||||
};
|
||||
}
|
||||
|
||||
[Params(Redis, SQL)]
|
||||
[Params(Redis, SQL, Cosmos)]
|
||||
public string StoreType { get; set; } = null!;
|
||||
|
||||
[GlobalSetup]
|
||||
@ -83,6 +92,10 @@ public class RedisPersistedGrantStoreTests
|
||||
{
|
||||
_grantStore = _sqlGrantStore;
|
||||
}
|
||||
else if (StoreType == Cosmos)
|
||||
{
|
||||
_grantStore = _cosmosGrantStore;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidProgramException();
|
||||
|
Reference in New Issue
Block a user