Service Factory
IdentityServer3 contains many features for implementing OpenID Connect and OAuth2. Many of these features have been designed so they can be replaced. This would be useful for the scenarios where the default logic doesn’t match the hosting application’s requirements, or simply the application wishes to provide an entirely different implementation. And in fact, there are some extensibility points within IdentityServer3 that are required to be provided by the hosting application (such as the storage for configuration data or the identity management implementation for validating users’ credentials).
The IdentityServer3.Core.Configuration.IdentityServerServiceFactory
holds all these building blocks and must be supplied at startup time using the IdentityServerOptions
class (see here for more information on configuration options).
The extensibility points fall into three categories.
Mandatory
UserService
- Implements user authentication against the local user store, association of external users, claims retrieval and sign-out logic. There are two standard implementations for MembershipReboot and ASP.NET Identity
ScopeStore
- Implements retrieval of scopes configuration data
ClientStore
- Implements retrieval of client configuration data
The IdentityServerServiceFactory
allows setting up a service factory by providing in-memory stores for users, clients and scopes (see here).
Mandatory for production scenarios (but with default in-memory implementations)
AuthorizationCodeStore
- Implements storage and retrieval of authorization codes (interface)
TokenHandleStore
- Implements storage and retrieval of handles for reference tokens (interface)
RefreshTokenStore
- Implements storage and retrieval of refresh tokens (interface)
ConsentStore
- Implements storage and retrieval of consent decisions (interface)
ViewService
- Implements retrieval of UI assets. Defaults to using the embedded assets. (interface)
Optional (can be replaced, but have default implementations)
TokenService
- Implements creation of identity and access tokens (interface)
ClaimsProvider
- Implements retrieval of claims for identity and access tokens (interface)
TokenSigningService
- Implements creation and signing of security tokens (interface)
CustomGrantValidator
- Implements validation of custom grant types (interface)
CustomRequestValidator
- Implements custom additional validation of authorize and token requests (interface)
RefreshTokenService
- Implements creation and updates of refresh tokens (interface)
ExternalClaimsFilter
- Implements filtering and transformation of claims for external identity providers (interface)
CustomTokenValidator
- Implements custom additional validation of tokens for the token validation endpoints (interface)
CustomTokenResponseGenerator
- Allows adding additional data to a token response interface
ConsentService
- Implements logic of consent decisions (interface)
ClientPermissionsService
- Implements retrieval and revocation of consents, reference and refresh tokens (interface)
EventService
- Implements forwarding events to some logging system (e.g. elastic search) (interface)
RedirectUriValidator
- Implements validation of redirect and post logout URIs (interface)
LocalizationService
- Implements localization of display strings (interface)
CorsPolicyService
- Implements CORS policy (interface)
See here for more information on registering your custom service and store implementations.