diff --git a/src/OpenIddict.Server/IOpenIddictServerEventService.cs b/src/OpenIddict.Server/IOpenIddictServerEventDispatcher.cs
similarity index 83%
rename from src/OpenIddict.Server/IOpenIddictServerEventService.cs
rename to src/OpenIddict.Server/IOpenIddictServerEventDispatcher.cs
index 81a4944d..1d052114 100644
--- a/src/OpenIddict.Server/IOpenIddictServerEventService.cs
+++ b/src/OpenIddict.Server/IOpenIddictServerEventDispatcher.cs
@@ -13,7 +13,7 @@ namespace OpenIddict.Server
///
/// Dispatches events by invoking the corresponding handlers.
///
- public interface IOpenIddictServerEventService
+ public interface IOpenIddictServerEventDispatcher
{
///
/// Publishes a new event.
@@ -21,6 +21,6 @@ namespace OpenIddict.Server
/// The type of the event to publish.
/// The event to publish.
/// A that can be used to monitor the asynchronous operation.
- Task PublishAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictServerEvent;
+ Task DispatchAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictServerEvent;
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Authentication.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Authentication.cs
index fffc981a..6116fea7 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Authentication.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Authentication.cs
@@ -113,8 +113,8 @@ namespace OpenIddict.Server.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractAuthorizationRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractAuthorizationRequest(context));
}
public override async Task ValidateAuthorizationRequest([NotNull] ValidateAuthorizationRequestContext context)
@@ -441,8 +441,8 @@ namespace OpenIddict.Server.Internal
context.Validate();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateAuthorizationRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateAuthorizationRequest(context));
}
public override async Task HandleAuthorizationRequest([NotNull] HandleAuthorizationRequestContext context)
@@ -490,8 +490,8 @@ namespace OpenIddict.Server.Internal
return;
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleAuthorizationRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleAuthorizationRequest(context));
}
public override async Task ApplyAuthorizationResponse([NotNull] ApplyAuthorizationResponseContext context)
@@ -535,8 +535,8 @@ namespace OpenIddict.Server.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyAuthorizationResponse(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyAuthorizationResponse(context));
}
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Discovery.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Discovery.cs
index f4a11643..1c158642 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Discovery.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Discovery.cs
@@ -19,12 +19,12 @@ namespace OpenIddict.Server.Internal
public sealed partial class OpenIddictServerProvider : OpenIdConnectServerProvider
{
public override Task ExtractConfigurationRequest([NotNull] ExtractConfigurationRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractConfigurationRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractConfigurationRequest(context));
public override Task ValidateConfigurationRequest([NotNull] ValidateConfigurationRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateConfigurationRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateConfigurationRequest(context));
public override Task HandleConfigurationRequest([NotNull] HandleConfigurationRequestContext context)
{
@@ -54,27 +54,28 @@ namespace OpenIddict.Server.Internal
context.Metadata[OpenIdConnectConstants.Metadata.RequestParameterSupported] = false;
context.Metadata[OpenIdConnectConstants.Metadata.RequestUriParameterSupported] = false;
- return GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.HandleConfigurationRequest(context));
+ return GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleConfigurationRequest(context));
}
public override Task ApplyConfigurationResponse([NotNull] ApplyConfigurationResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyConfigurationResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyConfigurationResponse(context));
public override Task ExtractCryptographyRequest([NotNull] ExtractCryptographyRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractCryptographyRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractCryptographyRequest(context));
public override Task ValidateCryptographyRequest([NotNull] ValidateCryptographyRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateCryptographyRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateCryptographyRequest(context));
public override Task HandleCryptographyRequest([NotNull] HandleCryptographyRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleCryptographyRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleCryptographyRequest(context));
public override Task ApplyCryptographyResponse([NotNull] ApplyCryptographyResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyCryptographyResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyCryptographyResponse(context));
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Exchange.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Exchange.cs
index 937e2da2..6c5f2372 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Exchange.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Exchange.cs
@@ -27,8 +27,8 @@ namespace OpenIddict.Server.Internal
public sealed partial class OpenIddictServerProvider : OpenIdConnectServerProvider
{
public override Task ExtractTokenRequest([NotNull] ExtractTokenRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractTokenRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractTokenRequest(context));
public override async Task ValidateTokenRequest([NotNull] ValidateTokenRequestContext context)
{
@@ -316,8 +316,8 @@ namespace OpenIddict.Server.Internal
context.Validate();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateTokenRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateTokenRequest(context));
}
public override async Task HandleTokenRequest([NotNull] HandleTokenRequestContext context)
@@ -340,8 +340,8 @@ namespace OpenIddict.Server.Internal
// the user code to handle the token request.
context.SkipToNextMiddleware();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleTokenRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleTokenRequest(context));
return;
}
@@ -433,12 +433,12 @@ namespace OpenIddict.Server.Internal
// the user code to handle the token request.
context.SkipToNextMiddleware();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleTokenRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleTokenRequest(context));
}
public override Task ApplyTokenResponse([NotNull] ApplyTokenResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyTokenResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyTokenResponse(context));
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Helpers.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Helpers.cs
index a5b37d6d..a28b0dec 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Helpers.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Helpers.cs
@@ -669,8 +669,8 @@ namespace OpenIddict.Server.Internal
private static ILogger GetLogger(IServiceProvider provider)
=> provider.GetRequiredService>();
- private static IOpenIddictServerEventService GetEventService(IServiceProvider provider)
- => provider.GetRequiredService();
+ private static IOpenIddictServerEventDispatcher GetEventDispatcher(IServiceProvider provider)
+ => provider.GetRequiredService();
private static IOpenIddictApplicationManager GetApplicationManager(IServiceProvider provider)
=> provider.GetService() ?? throw new InvalidOperationException(new StringBuilder()
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Introspection.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Introspection.cs
index 5c353839..577703de 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Introspection.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Introspection.cs
@@ -23,8 +23,8 @@ namespace OpenIddict.Server.Internal
public sealed partial class OpenIddictServerProvider : OpenIdConnectServerProvider
{
public override Task ExtractIntrospectionRequest([NotNull] ExtractIntrospectionRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractIntrospectionRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractIntrospectionRequest(context));
public override async Task ValidateIntrospectionRequest([NotNull] ValidateIntrospectionRequestContext context)
{
@@ -102,8 +102,8 @@ namespace OpenIddict.Server.Internal
context.Validate();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateIntrospectionRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateIntrospectionRequest(context));
}
public override async Task HandleIntrospectionRequest([NotNull] HandleIntrospectionRequestContext context)
@@ -185,12 +185,12 @@ namespace OpenIddict.Server.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleIntrospectionRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleIntrospectionRequest(context));
}
public override Task ApplyIntrospectionResponse([NotNull] ApplyIntrospectionResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyIntrospectionResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyIntrospectionResponse(context));
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Revocation.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Revocation.cs
index 0b57d799..3a4b624d 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Revocation.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Revocation.cs
@@ -25,8 +25,8 @@ namespace OpenIddict.Server.Internal
public sealed partial class OpenIddictServerProvider : OpenIdConnectServerProvider
{
public override Task ExtractRevocationRequest([NotNull] ExtractRevocationRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractRevocationRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractRevocationRequest(context));
public override async Task ValidateRevocationRequest([NotNull] ValidateRevocationRequestContext context)
{
@@ -169,8 +169,8 @@ namespace OpenIddict.Server.Internal
context.Validate();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateRevocationRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateRevocationRequest(context));
}
public override async Task HandleRevocationRequest([NotNull] HandleRevocationRequestContext context)
@@ -242,12 +242,12 @@ namespace OpenIddict.Server.Internal
context.Revoked = true;
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleRevocationRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleRevocationRequest(context));
}
public override Task ApplyRevocationResponse([NotNull] ApplyRevocationResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyRevocationResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyRevocationResponse(context));
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Serialization.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Serialization.cs
index 27fcdaae..2fed13fe 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Serialization.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Serialization.cs
@@ -39,7 +39,8 @@ namespace OpenIddict.Server.Internal
context.HandleResponse();
}
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.DeserializeAccessToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.DeserializeAccessToken(context));
}
public override async Task DeserializeAuthorizationCode([NotNull] DeserializeAuthorizationCodeContext context)
@@ -58,11 +59,13 @@ namespace OpenIddict.Server.Internal
// Prevent the OpenID Connect server middleware from using its default logic.
context.HandleResponse();
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.DeserializeAuthorizationCode(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.DeserializeAuthorizationCode(context));
}
public override Task DeserializeIdentityToken(DeserializeIdentityTokenContext context)
- => GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.DeserializeIdentityToken(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.DeserializeIdentityToken(context));
public override async Task DeserializeRefreshToken([NotNull] DeserializeRefreshTokenContext context)
{
@@ -80,7 +83,8 @@ namespace OpenIddict.Server.Internal
// Prevent the OpenID Connect server middleware from using its default logic.
context.HandleResponse();
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.DeserializeRefreshToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.DeserializeRefreshToken(context));
}
public override async Task SerializeAccessToken([NotNull] SerializeAccessTokenContext context)
@@ -107,7 +111,8 @@ namespace OpenIddict.Server.Internal
// Otherwise, let the OpenID Connect server middleware
// serialize the token using its default internal logic.
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.SerializeAccessToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.SerializeAccessToken(context));
}
public override async Task SerializeAuthorizationCode([NotNull] SerializeAuthorizationCodeContext context)
@@ -136,11 +141,13 @@ namespace OpenIddict.Server.Internal
// Otherwise, let the OpenID Connect server middleware
// serialize the token using its default internal logic.
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.SerializeAuthorizationCode(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.SerializeAuthorizationCode(context));
}
public override Task SerializeIdentityToken(SerializeIdentityTokenContext context)
- => GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.SerializeIdentityToken(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.SerializeIdentityToken(context));
public override async Task SerializeRefreshToken([NotNull] SerializeRefreshTokenContext context)
{
@@ -168,7 +175,8 @@ namespace OpenIddict.Server.Internal
// Otherwise, let the OpenID Connect server middleware
// serialize the token using its default internal logic.
- await GetEventService(context.HttpContext.RequestServices).PublishAsync(new OpenIddictServerEvents.SerializeRefreshToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.SerializeRefreshToken(context));
}
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Session.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Session.cs
index c2f750de..0c01573b 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Session.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Session.cs
@@ -84,8 +84,8 @@ namespace OpenIddict.Server.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractLogoutRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractLogoutRequest(context));
}
public override async Task ValidateLogoutRequest([NotNull] ValidateLogoutRequestContext context)
@@ -162,8 +162,8 @@ namespace OpenIddict.Server.Internal
context.Validate();
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateLogoutRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateLogoutRequest(context));
}
public override async Task HandleLogoutRequest([NotNull] HandleLogoutRequestContext context)
@@ -211,8 +211,8 @@ namespace OpenIddict.Server.Internal
return;
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleLogoutRequest(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleLogoutRequest(context));
}
public override async Task ApplyLogoutResponse([NotNull] ApplyLogoutResponseContext context)
@@ -256,8 +256,8 @@ namespace OpenIddict.Server.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyLogoutResponse(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyLogoutResponse(context));
}
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Userinfo.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Userinfo.cs
index 4b65055c..373b7e26 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Userinfo.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.Userinfo.cs
@@ -29,20 +29,20 @@ namespace OpenIddict.Server.Internal
// the user code to handle the userinfo request.
context.SkipToNextMiddleware();
- return GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ExtractUserinfoRequest(context));
+ return GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ExtractUserinfoRequest(context));
}
public override Task ValidateUserinfoRequest([NotNull] ValidateUserinfoRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ValidateUserinfoRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ValidateUserinfoRequest(context));
public override Task HandleUserinfoRequest([NotNull] HandleUserinfoRequestContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.HandleUserinfoRequest(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.HandleUserinfoRequest(context));
public override Task ApplyUserinfoResponse([NotNull] ApplyUserinfoResponseContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ApplyUserinfoResponse(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ApplyUserinfoResponse(context));
}
}
diff --git a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.cs b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.cs
index 093bd184..aa118916 100644
--- a/src/OpenIddict.Server/Internal/OpenIddictServerProvider.cs
+++ b/src/OpenIddict.Server/Internal/OpenIddictServerProvider.cs
@@ -26,8 +26,8 @@ namespace OpenIddict.Server.Internal
public sealed partial class OpenIddictServerProvider : OpenIdConnectServerProvider
{
public override Task MatchEndpoint([NotNull] MatchEndpointContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.MatchEndpoint(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.MatchEndpoint(context));
public override Task ProcessChallengeResponse([NotNull] ProcessChallengeResponseContext context)
{
@@ -43,8 +43,8 @@ namespace OpenIddict.Server.Internal
context.Response.AddParameter(parameter.Item2, parameter.Item3);
}
- return GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ProcessChallengeResponse(context));
+ return GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ProcessChallengeResponse(context));
}
public override async Task ProcessSigninResponse([NotNull] ProcessSigninResponseContext context)
@@ -199,8 +199,8 @@ namespace OpenIddict.Server.Internal
context.Ticket.RemoveProperty(parameter.Item1);
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ProcessSigninResponse(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ProcessSigninResponse(context));
}
public override Task ProcessSignoutResponse([NotNull] ProcessSignoutResponseContext context)
@@ -214,8 +214,8 @@ namespace OpenIddict.Server.Internal
context.Response.AddParameter(parameter.Item2, parameter.Item3);
}
- return GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictServerEvents.ProcessSignoutResponse(context));
+ return GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictServerEvents.ProcessSignoutResponse(context));
}
}
}
diff --git a/src/OpenIddict.Server/OpenIddictServerEventService.cs b/src/OpenIddict.Server/OpenIddictServerEventDispatcher.cs
similarity index 84%
rename from src/OpenIddict.Server/OpenIddictServerEventService.cs
rename to src/OpenIddict.Server/OpenIddictServerEventDispatcher.cs
index f53ec8cf..a002e3f8 100644
--- a/src/OpenIddict.Server/OpenIddictServerEventService.cs
+++ b/src/OpenIddict.Server/OpenIddictServerEventDispatcher.cs
@@ -14,14 +14,14 @@ namespace OpenIddict.Server
///
/// Dispatches events by invoking the corresponding notification handlers.
///
- public class OpenIddictServerEventService : IOpenIddictServerEventService
+ public class OpenIddictServerEventDispatcher : IOpenIddictServerEventDispatcher
{
private readonly IServiceProvider _provider;
///
- /// Creates a new instance of the class.
+ /// Creates a new instance of the class.
///
- public OpenIddictServerEventService([NotNull] IServiceProvider provider)
+ public OpenIddictServerEventDispatcher([NotNull] IServiceProvider provider)
=> _provider = provider;
///
@@ -30,7 +30,7 @@ namespace OpenIddict.Server
/// The type of the event to publish.
/// The event to publish.
/// A that can be used to monitor the asynchronous operation.
- public async Task PublishAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictServerEvent
+ public async Task DispatchAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictServerEvent
{
if (notification == null)
{
diff --git a/src/OpenIddict.Server/OpenIddictServerExtensions.cs b/src/OpenIddict.Server/OpenIddictServerExtensions.cs
index 4d83520e..62b05fac 100644
--- a/src/OpenIddict.Server/OpenIddictServerExtensions.cs
+++ b/src/OpenIddict.Server/OpenIddictServerExtensions.cs
@@ -46,7 +46,7 @@ namespace Microsoft.Extensions.DependencyInjection
builder.Services.AddMemoryCache();
builder.Services.AddOptions();
- builder.Services.TryAddScoped();
+ builder.Services.TryAddScoped();
return new OpenIddictServerBuilder(builder.Services);
}
diff --git a/src/OpenIddict.Validation/IOpenIddictValidationEventService.cs b/src/OpenIddict.Validation/IOpenIddictValidationEventDispatcher.cs
similarity index 82%
rename from src/OpenIddict.Validation/IOpenIddictValidationEventService.cs
rename to src/OpenIddict.Validation/IOpenIddictValidationEventDispatcher.cs
index 05b7bcf0..8eff3d1a 100644
--- a/src/OpenIddict.Validation/IOpenIddictValidationEventService.cs
+++ b/src/OpenIddict.Validation/IOpenIddictValidationEventDispatcher.cs
@@ -12,7 +12,7 @@ namespace OpenIddict.Validation
///
/// Dispatches events by invoking the corresponding handlers.
///
- public interface IOpenIddictValidationEventService
+ public interface IOpenIddictValidationEventDispatcher
{
///
/// Publishes a new event.
@@ -20,6 +20,6 @@ namespace OpenIddict.Validation
/// The type of the event to publish.
/// The event to publish.
/// A that can be used to monitor the asynchronous operation.
- Task PublishAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictValidationEvent;
+ Task DispatchAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictValidationEvent;
}
}
diff --git a/src/OpenIddict.Validation/Internal/OpenIddictValidationProvider.cs b/src/OpenIddict.Validation/Internal/OpenIddictValidationProvider.cs
index 94cf6896..c033073d 100644
--- a/src/OpenIddict.Validation/Internal/OpenIddictValidationProvider.cs
+++ b/src/OpenIddict.Validation/Internal/OpenIddictValidationProvider.cs
@@ -24,12 +24,12 @@ namespace OpenIddict.Validation.Internal
public sealed class OpenIddictValidationProvider : OAuthValidationEvents
{
public override Task ApplyChallenge([NotNull] ApplyChallengeContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictValidationEvents.ApplyChallenge(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictValidationEvents.ApplyChallenge(context));
public override Task CreateTicket([NotNull] CreateTicketContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictValidationEvents.CreateTicket(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictValidationEvents.CreateTicket(context));
public override async Task DecryptToken([NotNull] DecryptTokenContext context)
{
@@ -113,13 +113,13 @@ namespace OpenIddict.Validation.Internal
context.HandleResponse();
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictValidationEvents.DecryptToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictValidationEvents.DecryptToken(context));
}
public override Task RetrieveToken([NotNull] RetrieveTokenContext context)
- => GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictValidationEvents.RetrieveToken(context));
+ => GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictValidationEvents.RetrieveToken(context));
public override async Task ValidateToken([NotNull] ValidateTokenContext context)
{
@@ -183,14 +183,14 @@ namespace OpenIddict.Validation.Internal
}
}
- await GetEventService(context.HttpContext.RequestServices)
- .PublishAsync(new OpenIddictValidationEvents.ValidateToken(context));
+ await GetEventDispatcher(context.HttpContext.RequestServices)
+ .DispatchAsync(new OpenIddictValidationEvents.ValidateToken(context));
}
private static ILogger GetLogger(IServiceProvider provider)
=> provider.GetRequiredService>();
- private static IOpenIddictValidationEventService GetEventService(IServiceProvider provider)
- => provider.GetRequiredService();
+ private static IOpenIddictValidationEventDispatcher GetEventDispatcher(IServiceProvider provider)
+ => provider.GetRequiredService();
}
}
diff --git a/src/OpenIddict.Validation/OpenIddictValidationEventService.cs b/src/OpenIddict.Validation/OpenIddictValidationEventDispatcher.cs
similarity index 83%
rename from src/OpenIddict.Validation/OpenIddictValidationEventService.cs
rename to src/OpenIddict.Validation/OpenIddictValidationEventDispatcher.cs
index e2f09056..58fd7171 100644
--- a/src/OpenIddict.Validation/OpenIddictValidationEventService.cs
+++ b/src/OpenIddict.Validation/OpenIddictValidationEventDispatcher.cs
@@ -14,14 +14,14 @@ namespace OpenIddict.Validation
///
/// Dispatches events by invoking the corresponding notification handlers.
///
- public class OpenIddictValidationEventService : IOpenIddictValidationEventService
+ public class OpenIddictValidationEventDispatcher : IOpenIddictValidationEventDispatcher
{
private readonly IServiceProvider _provider;
///
- /// Creates a new instance of the class.
+ /// Creates a new instance of the class.
///
- public OpenIddictValidationEventService([NotNull] IServiceProvider provider)
+ public OpenIddictValidationEventDispatcher([NotNull] IServiceProvider provider)
=> _provider = provider;
///
@@ -30,7 +30,7 @@ namespace OpenIddict.Validation
/// The type of the event to publish.
/// The event to publish.
/// A that can be used to monitor the asynchronous operation.
- public async Task PublishAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictValidationEvent
+ public async Task DispatchAsync([NotNull] TEvent notification) where TEvent : class, IOpenIddictValidationEvent
{
if (notification == null)
{
diff --git a/src/OpenIddict.Validation/OpenIddictValidationExtensions.cs b/src/OpenIddict.Validation/OpenIddictValidationExtensions.cs
index 717905f1..86c3bdde 100644
--- a/src/OpenIddict.Validation/OpenIddictValidationExtensions.cs
+++ b/src/OpenIddict.Validation/OpenIddictValidationExtensions.cs
@@ -42,7 +42,7 @@ namespace Microsoft.Extensions.DependencyInjection
builder.Services.AddLogging();
builder.Services.AddOptions();
- builder.Services.TryAddScoped();
+ builder.Services.TryAddScoped();
return new OpenIddictValidationBuilder(builder.Services);
}
diff --git a/test/OpenIddict.Server.Tests/OpenIddictServerEventServiceTests.cs b/test/OpenIddict.Server.Tests/OpenIddictServerEventDispatcherTests.cs
similarity index 80%
rename from test/OpenIddict.Server.Tests/OpenIddictServerEventServiceTests.cs
rename to test/OpenIddict.Server.Tests/OpenIddictServerEventDispatcherTests.cs
index 6d3ecbc0..ef9ae50e 100644
--- a/test/OpenIddict.Server.Tests/OpenIddictServerEventServiceTests.cs
+++ b/test/OpenIddict.Server.Tests/OpenIddictServerEventDispatcherTests.cs
@@ -12,24 +12,24 @@ using Xunit;
namespace OpenIddict.Server.Tests
{
- public class OpenIddictServerEventServiceTests
+ public class OpenIddictServerEventDispatcherTests
{
[Fact]
- public async Task PublishAsync_ThrowsAnExceptionForNullNotification()
+ public async Task DispatchAsync_ThrowsAnExceptionForNullNotification()
{
// Arrange
var provider = Mock.Of();
- var service = new OpenIddictServerEventService(provider);
+ var dispatcher = new OpenIddictServerEventDispatcher(provider);
// Act and assert
var exception = await Assert.ThrowsAsync(()
- => service.PublishAsync(notification: null));
+ => dispatcher.DispatchAsync(notification: null));
Assert.Equal("notification", exception.ParamName);
}
[Fact]
- public async Task PublishAsync_InvokesHandlers()
+ public async Task DispatchAsync_InvokesHandlers()
{
// Arrange
var handlers = new List>
@@ -42,12 +42,12 @@ namespace OpenIddict.Server.Tests
provider.Setup(mock => mock.GetService(typeof(IEnumerable>)))
.Returns(handlers);
- var service = new OpenIddictServerEventService(provider.Object);
+ var dispatcher = new OpenIddictServerEventDispatcher(provider.Object);
var notification = new Event();
// Act
- await service.PublishAsync(notification);
+ await dispatcher.DispatchAsync(notification);
// Assert
Mock.Get(handlers[0]).Verify(mock => mock.HandleAsync(notification), Times.Once());
@@ -55,7 +55,7 @@ namespace OpenIddict.Server.Tests
}
[Fact]
- public async Task PublishAsync_StopsInvokingHandlersWhenHandledIsReturned()
+ public async Task DispatchAsync_StopsInvokingHandlersWhenHandledIsReturned()
{
// Arrange
var handlers = new List>
@@ -73,12 +73,12 @@ namespace OpenIddict.Server.Tests
provider.Setup(mock => mock.GetService(typeof(IEnumerable>)))
.Returns(handlers);
- var service = new OpenIddictServerEventService(provider.Object);
+ var dispatcher = new OpenIddictServerEventDispatcher(provider.Object);
var notification = new Event();
// Act
- await service.PublishAsync(notification);
+ await dispatcher.DispatchAsync(notification);
// Assert
Mock.Get(handlers[0]).Verify(mock => mock.HandleAsync(notification), Times.Once());
diff --git a/test/OpenIddict.Server.Tests/OpenIddictServerExtensionsTests.cs b/test/OpenIddict.Server.Tests/OpenIddictServerExtensionsTests.cs
index eb9da1bd..33032a64 100644
--- a/test/OpenIddict.Server.Tests/OpenIddictServerExtensionsTests.cs
+++ b/test/OpenIddict.Server.Tests/OpenIddictServerExtensionsTests.cs
@@ -104,8 +104,8 @@ namespace OpenIddict.Server.Tests
// Assert
Assert.Contains(services, service => service.Lifetime == ServiceLifetime.Scoped &&
- service.ServiceType == typeof(IOpenIddictServerEventService) &&
- service.ImplementationType == typeof(OpenIddictServerEventService));
+ service.ServiceType == typeof(IOpenIddictServerEventDispatcher) &&
+ service.ImplementationType == typeof(OpenIddictServerEventDispatcher));
}
[Fact]
diff --git a/test/OpenIddict.Validation.Tests/OpenIddictValidationEventServiceTests.cs b/test/OpenIddict.Validation.Tests/OpenIddictValidationEventDispatcherTests.cs
similarity index 80%
rename from test/OpenIddict.Validation.Tests/OpenIddictValidationEventServiceTests.cs
rename to test/OpenIddict.Validation.Tests/OpenIddictValidationEventDispatcherTests.cs
index b066f523..c1e77f9a 100644
--- a/test/OpenIddict.Validation.Tests/OpenIddictValidationEventServiceTests.cs
+++ b/test/OpenIddict.Validation.Tests/OpenIddictValidationEventDispatcherTests.cs
@@ -12,24 +12,24 @@ using Xunit;
namespace OpenIddict.Validation.Tests
{
- public class OpenIddictValidationEventServiceTests
+ public class OpenIddictValidationEventDispatcherTests
{
[Fact]
- public async Task PublishAsync_ThrowsAnExceptionForNullNotification()
+ public async Task DispatchAsync_ThrowsAnExceptionForNullNotification()
{
// Arrange
var provider = Mock.Of();
- var service = new OpenIddictValidationEventService(provider);
+ var dispatcher = new OpenIddictValidationEventDispatcher(provider);
// Act and assert
var exception = await Assert.ThrowsAsync(()
- => service.PublishAsync(notification: null));
+ => dispatcher.DispatchAsync(notification: null));
Assert.Equal("notification", exception.ParamName);
}
[Fact]
- public async Task PublishAsync_InvokesHandlers()
+ public async Task DispatchAsync_InvokesHandlers()
{
// Arrange
var handlers = new List>
@@ -42,12 +42,12 @@ namespace OpenIddict.Validation.Tests
provider.Setup(mock => mock.GetService(typeof(IEnumerable>)))
.Returns(handlers);
- var service = new OpenIddictValidationEventService(provider.Object);
+ var dispatcher = new OpenIddictValidationEventDispatcher(provider.Object);
var notification = new Event();
// Act
- await service.PublishAsync(notification);
+ await dispatcher.DispatchAsync(notification);
// Assert
Mock.Get(handlers[0]).Verify(mock => mock.HandleAsync(notification), Times.Once());
@@ -55,7 +55,7 @@ namespace OpenIddict.Validation.Tests
}
[Fact]
- public async Task PublishAsync_StopsInvokingHandlersWhenHandledIsReturned()
+ public async Task DispatchAsync_StopsInvokingHandlersWhenHandledIsReturned()
{
// Arrange
var handlers = new List>
@@ -73,12 +73,12 @@ namespace OpenIddict.Validation.Tests
provider.Setup(mock => mock.GetService(typeof(IEnumerable>)))
.Returns(handlers);
- var service = new OpenIddictValidationEventService(provider.Object);
+ var dispatcher = new OpenIddictValidationEventDispatcher(provider.Object);
var notification = new Event();
// Act
- await service.PublishAsync(notification);
+ await dispatcher.DispatchAsync(notification);
// Assert
Mock.Get(handlers[0]).Verify(mock => mock.HandleAsync(notification), Times.Once());
diff --git a/test/OpenIddict.Validation.Tests/OpenIddictValidationExtensionsTests.cs b/test/OpenIddict.Validation.Tests/OpenIddictValidationExtensionsTests.cs
index 4291a248..4531ff3e 100644
--- a/test/OpenIddict.Validation.Tests/OpenIddictValidationExtensionsTests.cs
+++ b/test/OpenIddict.Validation.Tests/OpenIddictValidationExtensionsTests.cs
@@ -83,8 +83,8 @@ namespace OpenIddict.Validation.Tests
// Assert
Assert.Contains(services, service => service.Lifetime == ServiceLifetime.Scoped &&
- service.ServiceType == typeof(IOpenIddictValidationEventService) &&
- service.ImplementationType == typeof(OpenIddictValidationEventService));
+ service.ServiceType == typeof(IOpenIddictValidationEventDispatcher) &&
+ service.ImplementationType == typeof(OpenIddictValidationEventDispatcher));
}
[Fact]