Giter Site home page Giter Site logo

Comments (3)

manfredsteyer avatar manfredsteyer commented on August 15, 2024

Ok, I've got it. great idea!

from aspnet.security.openidconnect.server.

kevinchalet avatar kevinchalet commented on August 15, 2024

For reference, here's the commit who introduced the "destination" switch: e775161.

Here's how it works:

  • for access and refresh tokens, all claims are copied from the ambient ClaimsIdentity unless they explicitly provide a destination that doesn't include "token". Because access and refresh tokens are most of the times opaque for the client, including all claims by default seemed a good compromise between confidentiality and usability.
  • for identity tokens, that's an inverse reasoning (because JWT tokens are not opaque for the clients): claims are not added to the identity token unless they explicitly specify an id_token destination.

Note that you can combine both switches by specifying an id_token token destination 😃

from aspnet.security.openidconnect.server.

kevinchalet avatar kevinchalet commented on August 15, 2024

With access tokens now being JWT tokens by default, the behavior described in my previous post has changed:

  • Refresh tokens and authorization codes: when they are not explicitly provided through the CreateAuthorizationCode/CreateRefreshToken notifications, authorization codes and refresh tokens are serialized using a data protector and claims are never filtered.
  • Identity tokens and access tokens: these tokens can be natively created using a security token handler, a data protector or using the CreateIdentityToken/CreateAccessToken notifications.
    • When they are created using CreateIdentityToken/CreateAccessToken, it's up to the implementer to correctly filter the identities before serialization if the returned tokens are not opaque. To make it easier, new ClaimsIdentity.Clone extensions have been added to the extensions package: https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server/blob/dev/src/Owin.Security.OpenIdConnect.Extensions/OpenIdConnectExtensions.cs#L305
    • When they are created using a security token handler, claims are automatically excluded if they don't explicitly contain the id_token or token destination.
    • When they are created using a data protector, these tokens are assumed to be opaque and claims are only excluded if they contain an explicit destination that doesn't include id_token or token.

from aspnet.security.openidconnect.server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.