public static bool IsEndpointEnabled(this EndpointsOptions options, IdentityServer4.Hosting.Endpoint endpoint) { switch (endpoint?.Name) { case EndpointNames.Authorize: return(options.EnableAuthorizeEndpoint); case EndpointNames.CheckSession: return(options.EnableCheckSessionEndpoint); case EndpointNames.Discovery: return(options.EnableDiscoveryEndpoint); case EndpointNames.EndSession: return(options.EnableEndSessionEndpoint); case EndpointNames.Introspection: return(options.EnableIntrospectionEndpoint); case EndpointNames.Revocation: return(options.EnableTokenRevocationEndpoint); case EndpointNames.Token: return(options.EnableTokenEndpoint); case EndpointNames.UserInfo: return(options.EnableUserInfoEndpoint); default: // fall thru to true to allow custom endpoints return(true); } }
private IEndpointHandler GetEndpointHandler(IdentityServer4.Hosting.Endpoint endpoint, HttpContext context) { if (_options.Endpoints.IsEndpointEnabled(endpoint)) { var handler = context.RequestServices.GetService(endpoint.Handler) as IEndpointHandler; if (handler != null) { _logger.LogDebug("Endpoint enabled: {endpoint}, successfully created handler: {endpointHandler}", endpoint.Name, endpoint.Handler.FullName); return(handler); } else { _logger.LogDebug("Endpoint enabled: {endpoint}, failed to create handler: {endpointHandler}", endpoint.Name, endpoint.Handler.FullName); } } else { _logger.LogWarning("Endpoint disabled: {endpoint}", endpoint.Name); } return(null); }