This post is the seventh part of a series of blog posts entitled Creating your own OpenID Connect server with ASOS:
- Introduction
- Choosing the right flow(s)
- Registering the middleware in the ASP.NET Core pipeline
- Creating your own authorization provider
- Implementing the resource owner password credentials grant
- Implementing the authorization code and implicit flows
- Adding custom claims and granting scopes
- Testing your authorization server with Postman
- Conclusion
Attaching a destination to custom claims using AddClaim
or SetDestinations
Unlike OAuthAuthorizationServerMiddleware
, ASOS doesn't assume that access tokens are always consumed by your own resource servers and refuses to serialize claims that don't explicitly specify a destination to avoid leaking confidential data to unauthorized parties.
Two destinations are currently supported by ASOS: access_token
and id_token
. There's no equivalent for authorization codes or refresh tokens as they are always encrypted and only readable by the authorization server itself.
Concretely, this means that all your claims won't be returned to the client application, unless you explicitly call the AddClaim
overload taking one or more destinations or use SetDestinations
to attach the appropriate destination(s) to your claims.
1 | var identity = new ClaimsIdentity(OpenIdConnectServerDefaults.AuthenticationScheme); |