1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-19 18:38:03 -05:00
Kyle Spearrin a6db79f613
[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
2024-01-10 12:59:16 +00:00

44 lines
1.3 KiB
C#

#nullable enable
using System.ComponentModel.DataAnnotations;
using Bit.Core.Auth.Models.Data;
using Duende.IdentityServer.Models;
namespace Bit.Core.Auth.Entities;
public class Grant : IGrant
{
public Grant() { }
public Grant(PersistedGrant pGrant)
{
Key = pGrant.Key;
Type = pGrant.Type;
SubjectId = pGrant.SubjectId;
SessionId = pGrant.SessionId;
ClientId = pGrant.ClientId;
Description = pGrant.Description;
CreationDate = pGrant.CreationTime;
ExpirationDate = pGrant.Expiration;
ConsumedDate = pGrant.ConsumedTime;
Data = pGrant.Data;
}
public int Id { get; set; }
[MaxLength(200)]
public string Key { get; set; } = null!;
[MaxLength(50)]
public string Type { get; set; } = null!;
[MaxLength(200)]
public string? SubjectId { get; set; }
[MaxLength(100)]
public string? SessionId { get; set; }
[MaxLength(200)]
public string ClientId { get; set; } = null!;
[MaxLength(200)]
public string? Description { get; set; }
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
public DateTime? ExpirationDate { get; set; }
public DateTime? ConsumedDate { get; set; }
public string Data { get; set; } = null!;
}