liveBook · Manning

Target audience

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

An audience is the intended recipient identified by a token's audience claim.

A target audience identifies the intended recipient of a token through its audience claim. API authentication uses this value to recognize tokens issued for accepted application endpoints. section 25.2 section 25.4.1

The audience must match a configured valid audience. The user-jwts tool derives valid audiences from the application URLs in launchSettings.json, so tokens can work across configured development profiles. section 25.4.1

Configured development audiences

A bearer configuration can list http://localhost:5073 and https://localhost:7112 as valid audiences. A generated JWT includes these application URLs in its aud claims. section 25.4.1

{
 "Authentication": {
   "Schemes": {
     "Bearer": {
       "ValidAudiences": [
         "http://localhost:5073",
         "https://localhost:7112"
       ],
       "ValidIssuer": "dotnet-user-jwts"
     }
   }
 }
}

Inspect a bearer authentication configuration that declares multiple valid audience URLs. section 25.4.1

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

How deep it goes
Defines audience claims and demonstrates valid-audience configuration, but does not detail the internal validation algorithm.
Examples
Uses launchSettings.json application URLs, ValidAudiences configuration, and aud claims generated by the user-jwts tool.
What you can do after
Configure it via user-jwts and bearer authentication settings for development API requests.
How it connects
Connects target audience with bearer token authentication, JSON Web Tokens, authentication middleware, and issuer validation.

Also explained in

Compare how 6 books explain target audience →

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.