Still working on getting client credential flow complete, most of the request works but still working on generating the JWT.
This commit is contained in:
parent
1a8c63808a
commit
8782ef39c6
80 changed files with 1331 additions and 414 deletions
|
|
@ -1,12 +1,6 @@
|
|||
using IdentityShroud.Core.Security;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core;
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class DekIdConverter : ValueConverter<DekId, Guid>
|
||||
{
|
||||
public DekIdConverter()
|
||||
: base(id => id.Id, guid => new DekId(guid))
|
||||
{
|
||||
}
|
||||
}
|
||||
public class DekIdConverter() : ValueConverter<DekId, Guid>(id => id.Id, guid => new DekId(guid));
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class DictionaryToJsonConverter<TKey, TValue> : ValueConverter<Dictionary<TKey, TValue>, string>
|
||||
where TKey : notnull
|
||||
{
|
||||
public DictionaryToJsonConverter() : base(
|
||||
v => JsonSerializer.Serialize(v),
|
||||
v => JsonSerializer.Deserialize<Dictionary<TKey, TValue>>(v) ?? new())
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class JwtSigAlgNameConverter() : ValueConverter<JwtSigAlgName, string>(j => j.ToString(), s => new(s));
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using IdentityShroud.Core.Security;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core;
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class KekIdConverter : ValueConverter<KekId, Guid>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
using IdentityShroud.Core.Security.Keys;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class KeyTypeConverter() : ValueConverter<KeyType, string>(id => id.ToString(), s => new(s));
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using IdentityShroud.Core.Model;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class RealmSigningKeyIdConverter : ValueConverter<RealmSigningKeyId, Guid>
|
||||
{
|
||||
public RealmSigningKeyIdConverter()
|
||||
: base(id => id.Id, guid => new RealmSigningKeyId(guid))
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Linq.Expressions;
|
||||
using IdentityShroud.Core.Model;
|
||||
using IdentityShroud.Core.Security;
|
||||
using IdentityShroud.Core.Security.Keys;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace IdentityShroud.Core;
|
||||
namespace IdentityShroud.Core.EFCore;
|
||||
|
||||
public class DbConfiguration
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ public class Db(
|
|||
{
|
||||
public virtual DbSet<Client> Clients { get; set; }
|
||||
public virtual DbSet<Realm> Realms { get; set; }
|
||||
public virtual DbSet<RealmKey> Keys { get; set; }
|
||||
public virtual DbSet<RealmSigningKey> Keys { get; set; }
|
||||
public virtual DbSet<RealmDek> Deks { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
|
@ -50,6 +50,10 @@ public class Db(
|
|||
base.ConfigureConventions(b);
|
||||
|
||||
b.Properties<DekId>().HaveConversion<DekIdConverter>();
|
||||
b.Properties<Dictionary<string, string>>().HaveConversion<DictionaryToJsonConverter<string, string>>();
|
||||
b.Properties<JwtSigAlgName>().HaveConversion<JwtSigAlgNameConverter>();
|
||||
b.Properties<KekId>().HaveConversion<KekIdConverter>();
|
||||
b.Properties<KeyType>().HaveConversion<KeyTypeConverter>();
|
||||
b.Properties<RealmSigningKeyId>().HaveConversion<RealmSigningKeyIdConverter>();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue