Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: auth code flow #2056

Closed

Conversation

TimoGlastra
Copy link
Contributor

@TimoGlastra TimoGlastra commented Oct 9, 2024

Initially I wanted to target this for 0.5.14, but to get rid of some technical debt and allow better adoption of new features I decided to make several breaking changes. Although OID4VCI is marked as experimental i think it warrants a 0.6 release due to the impact it will cause.

As we've been discussing a 0.6 already i think it's ok to make a new breaking release.

Also all credential offers that were made previously will now be invalidated. As they are only valid for a short period of time anyway, I think for this time it's ok. Due to how nonce are now managed in newer drafts (stateless) i had to rework the solution. Nonce ar enow even shorter lived and are signed, so we don't have to store them. In a follow up PR I'll add caching so we can still catch replay of nonces. We'll need a proper cache implementation for that though (if you do multi-instance in-memoery won't do it)

Todo

  • Handle issuer records with credentialsSupported over credentialConfigurationIds
  • Handle issuer records with display..url vs display..uri
  • allow configuration of batch size when requesting credentials
  • Authorization challenge endpoint and hook this into the verifier module

I don't think we need an actual PAR endpoint for general authorization, as we don't really have anything to authorize the user with (except for requesting a presentation using OID4VP). For all other flows an external authorization server makes sense.

Copy link

changeset-bot bot commented Oct 9, 2024

🦋 Changeset detected

Latest commit: bee17c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@credo-ts/openid4vc Minor
@credo-ts/action-menu Minor
@credo-ts/anoncreds Minor
@credo-ts/askar Minor
@credo-ts/bbs-signatures Minor
@credo-ts/cheqd Minor
@credo-ts/core Minor
@credo-ts/drpc Minor
@credo-ts/indy-sdk-to-askar-migration Minor
@credo-ts/indy-vdr Minor
@credo-ts/node Minor
@credo-ts/question-answer Minor
@credo-ts/react-native Minor
@credo-ts/tenants Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
…esentation during issuance and batch issuance.

This is a big change to OpenID4VCI in Credo, with the neccsary breaking changes since we first added it to the framework. Over time the spec has changed significantly, but also our understanding of the standards and protocols.

**Authorization Code Flow**
Credo now supports the authorization code flow, for both issuer and holder. An issuer can configure multiple authorization servers, and work with external authorization servers as well. The integration is based on OAuth2, with several extension specifications, mainly the OAuth2 JWT Access Token Profile, as well as Token Introspection (for opaque access tokens). Verification works out of the box, as longs as the authorization server has a `jwks_uri` configured. For Token Introspection it's also required to provide a `clientId` and `clientSecret` in the authorization server config.

To use an external authorization server, the authorization server MUST include the `issuer_state` parameter from the credential offer in the access token. Otherwise it's not possible for Credo to correlate the authorization session to the offer session.

The demo-openid contains an example with external authorization server, which can be used as reference. The Credo authorization server supports DPoP and PKCE.

**Batch Issuance**
The credential request to credential mapper has been updated to support multiple proofs, and also multiple credential instances. The client can now also handle batch issuance.

**Presentation During Issuance**
The presenation during issuance allows to request presentation using OID4VP before granting authorization for issuance of one or more credentials. This flow is automatically handled by the `resolveAuthorizationRequest` method on the oid4vci holder service.

Signed-off-by: Timo Glastra <[email protected]>
@TimoGlastra TimoGlastra changed the title feat: auth code flow feat!: auth code flow Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants