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,20 +1,28 @@
|
|||
using IdentityShroud.Core.Contracts;
|
||||
using IdentityShroud.Core.Messages;
|
||||
using IdentityShroud.Core.Model;
|
||||
using IdentityShroud.Core.Security.Keys;
|
||||
|
||||
namespace IdentityShroud.Api.Mappers;
|
||||
|
||||
public class KeyMapper(IKeyService keyService)
|
||||
public class KeyMapper(IKeyProviderFactory keyProviderFactory)
|
||||
{
|
||||
public JsonWebKeySet KeyListToJsonWebKeySet(IEnumerable<RealmKey> keys)
|
||||
public JsonWebKeySet KeyListToJsonWebKeySet(IEnumerable<RealmSigningKey> keys)
|
||||
{
|
||||
JsonWebKeySet wks = new();
|
||||
foreach (var k in keys)
|
||||
{
|
||||
var wk = keyService.CreateJsonWebKey(k);
|
||||
if (wk is {})
|
||||
IKeyProvider provider = keyProviderFactory.CreateProvider(k.KeyType);
|
||||
if (provider.IsPublic)
|
||||
{
|
||||
wks.Keys.Add(wk);
|
||||
JsonWebKey jwk = new()
|
||||
{
|
||||
KeyId = k.Id.ToString(),
|
||||
KeyType = k.KeyType,
|
||||
Use = "sig",
|
||||
};
|
||||
|
||||
provider.SetJwkParameters(k.PublicKeyParameters!, jwk);
|
||||
wks.Keys.Add(jwk);
|
||||
}
|
||||
}
|
||||
return wks;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue