public SigningCredentialStoreTest() { clock.SetupGet(i => i.UtcNow).Returns(Time(0)); scd = CreateSut(); signingStore = new SigningCredentialStore(scd); validationStore = new ValidationKeysStore(scd); }
/// <summary> /// Initializes a new instance of the <see cref="SignInResponseGenerator"/> class. /// </summary> /// <param name="contextAccessor">The context accessor.</param> /// <param name="profile">The profile.</param> /// <param name="keys">The keys.</param> /// <param name="resources">The resources.</param> /// <param name="logger">The logger.</param> public SignInResponseGenerator( IHttpContextAccessor contextAccessor, IProfileService profile, ISigningCredentialStore keys, IResourceStore resources, ILogger <SignInResponseGenerator> logger) { _contextAccessor = contextAccessor ?? throw new ArgumentNullException(nameof(contextAccessor)); _profile = profile ?? throw new ArgumentNullException(nameof(profile)); _keys = keys ?? throw new ArgumentNullException(nameof(keys)); _resources = resources ?? throw new ArgumentNullException(nameof(resources)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Initializes a new instance of the <see cref="SignInResponseGenerator"/> class. /// </summary> /// <param name="issuerNameService">The <see cref="IIssuerNameService"/>.</param> /// <param name="profile">The profile.</param> /// <param name="keys">The keys.</param> /// <param name="resources">The resources.</param> /// <param name="logger">The logger.</param> public SignInResponseGenerator( IIssuerNameService issuerNameService, IProfileService profile, ISigningCredentialStore keys, IResourceStore resources, ILogger <SignInResponseGenerator> logger) { _issuerNameService = issuerNameService ?? throw new ArgumentNullException(nameof(issuerNameService)); _profile = profile ?? throw new ArgumentNullException(nameof(profile)); _keys = keys ?? throw new ArgumentNullException(nameof(keys)); _resources = resources ?? throw new ArgumentNullException(nameof(resources)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public AccountController( IIdentityServerInteractionService interaction, IClientStore clientStore, IAuthenticationSchemeProvider schemeProvider, IEventService events, IUserService <User> userService, ILogger <AccountController> logger, ISigningCredentialStore signingCredentialStore, IStringLocalizer <AccountController> localizer ) { _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _interaction = interaction; _clientStore = clientStore; _schemeProvider = schemeProvider; _events = events; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _signingCredentialStore = signingCredentialStore ?? throw new ArgumentNullException(nameof(signingCredentialStore)); _localizer = localizer ?? throw new ArgumentNullException(nameof(localizer)); }
/// <summary> /// Gets the X509 certificate. /// </summary> /// <param name="key">The key.</param> /// <param name="store">The store.</param> /// <returns></returns> /// <exception cref="System.InvalidOperationException">Cannot use signing credential with key of type '{key.GetType().Name}'</exception> /// <exception cref="InvalidOperationException">Cannot use signing credential with key of type '{key.GetType().Name}'</exception> public static X509Certificate2 GetX509Certificate(this SecurityKey key, ISigningCredentialStore store) { if (key is RsaSecurityKey rsaKey) { var rsa = rsaKey.Rsa ?? RSA.Create(rsaKey.Parameters); var certRequest = new CertificateRequest("cn=theidserver", rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); if (store is IKeyRingStores keyRingStore) { var defaultKey = keyRingStore.DefaultKey; return(certRequest.CreateSelfSigned(defaultKey.ActivationDate, defaultKey.ExpirationDate)); } return(certRequest.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(1))); } else if (key is X509SecurityKey x509) { return(x509.Certificate); } else { throw new InvalidOperationException($"Cannot use signing credential with key of type '{key.GetType().Name}'"); } }
/// <summary> /// Initializes a new instance of the <see cref="MetadataResponseGenerator"/> class. /// </summary> /// <param name="contextAccessor">The context accessor.</param> /// <param name="keys">The keys.</param> public MetadataResponseGenerator(IHttpContextAccessor contextAccessor, ISigningCredentialStore keys) { _keys = keys; _contextAccessor = contextAccessor; }
/// <summary> /// Initializes a new instance of the <see cref="MetadataResponseGenerator"/> class. /// </summary> /// <param name="issuerNameService">The <see cref="IIssuerNameService"/>.</param> /// <param name="keys">The keys.</param> public MetadataResponseGenerator(IIssuerNameService issuerNameService, ISigningCredentialStore keys) { _keys = keys; _issuerNameService = issuerNameService; }
public DefaultKeyMaterialService(IEnumerable <IValidationKeysStore> validationKeys, ISigningCredentialStore signingCredential = null) { _signingCredential = signingCredential; _validationKeys = validationKeys; }
public DefaultTokenCreationService(ISigningCredentialStore credentialStore) { _credentialStore = credentialStore; }