liveBook · Manning

Identity provider

As explained in ASP.NET Core in Action, 3e

A third-party identity service is an externally operated identity provider that supplies authentication and identity-management capabilities to applications.

An identity provider handles sign-in and user management outside your application. Instead of storing customers’ passwords yourself, you can delegate those responsibilities to a service such as Auth0, Okta, or Azure Active Directory. This can reduce the sensitive user data your application holds, though you still need to choose and configure the provider carefully. section 23.1.2

A central identity provider is especially useful when several apps and APIs need to recognize the same users. An app redirects the user to the provider to sign in. The provider returns tokens to the client, which can send a bearer token to an API. This avoids duplicating sign-in screens and user-management logic across services, and can give users a single-sign-on experience. section 25.1.2

Figure 25.4 An alternative architecture involves using a central identity provider to handle all the authentication and user management for the system. Tokens are passed back and forth among the identity provider, apps, and APIs.
CH25_F04_Lock3

Follow the sign-in path from the app to the central provider, then the token path through the client to an API. section 25.1.2

Choose the arrangement that fits the application:

  • Use a third-party provider when you want to delegate user management and authentication. Check its integration instructions—ideally based on OpenID Connect—and understand who owns the resulting user profiles. section 23.1.2
  • Use ASP.NET Core Identity when you need to manage users in your own database instead. It supplies much of the authentication and user-management machinery, but the application still needs a working UI and must configure any external providers it uses. section 23.2

A photo service requests access

Suppose a photo-printing service asks to retrieve a user’s Facebook photos. It redirects the user to Facebook to sign in and approve access. OAuth 2.0 handles the delegated access; OpenID Connect builds on it when the service also needs identity information about the signed-in user. The service does not need to collect the user’s Facebook password. section 25.1.3

A provider is not a plug-and-play replacement for application security. Integration can require configuration both in the provider and in your app. APIs must still validate received tokens and decide what permitted actions mean for their own business logic. If a JWT is used, do not assume its contents are secret: JWTs are not encrypted by default. section 23.1.2 section 25.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains the redirect-and-token flow and selection tradeoffs, but defers provider-specific integration steps to provider documentation.
Examples
Uses named third-party services, a shared-provider architecture, and a photo-printing service requesting access to Facebook photos.
What it assumes
Introduces OAuth 2.0 and OpenID Connect at a basic level rather than requiring prior knowledge of their protocols.
What you can do after
Evaluate/understand when to delegate sign-in to a third-party provider rather than manage users in an application's own database.
How it connects
Connects identity providers to single sign-on, bearer tokens, ASP.NET Core Identity, OAuth 2.0, and OpenID Connect.

Also explained in

Compare how 12 books explain identity provider →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.