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

Refactor JAR logic #3078

Merged
merged 5 commits into from
May 5, 2024
Merged

Refactor JAR logic #3078

merged 5 commits into from
May 5, 2024

Conversation

gerardsn
Copy link
Member

@gerardsn gerardsn commented May 1, 2024

this change allows mocking and prepares to for adding request_uri_method

part of #2712

@gerardsn gerardsn marked this pull request as draft May 1, 2024 13:46
@gerardsn gerardsn requested a review from reinkrul May 1, 2024 13:46
keyResolver resolver.KeyResolver
}

type JAR interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split it in JARCreater and JARParser? Since I'd expected JAR to be the signed request object itself

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this follow the design pattern Wout used in his DPoP PR (can it?)? Since it's sort of the same thing/principle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this as is since the goal is to logically group some methods together so they can be mocked. Might change when the request_uri_method=post is added. (next PR)

As for comparison to the DPoP PR. I see the resemblance between the two, but I don't want to mirror it since that requires moving JAR to the crypto module. The JWTSigner interface currently meets the needs we had for did:nuts, but not for did:web I think that interface should be updated so we don't pollute the crypto package.

auth/api/iam/jar.go Outdated Show resolved Hide resolved
// Sign the requestObject, which is available on requestObject.Token.
// Returns an error if the requestObject already contains a signed JWT.
// TODO: check if signature type of client is supported by the AS/wallet.
Sign(ctx context.Context, ro *requestObject) error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could return a signed requestobject

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signing now happens when the request object is fetched, so this now returns the token as sting. This change allows for consistent behavior in both get/post request_uri_methods. It also means the signed token is no longer part of the state / in storage.

Signing now happens on the external call, and not the internal call. This probably means the audit on signing is in the wrong place again?

@@ -145,8 +145,17 @@ paths:
schema:
type: string
format: uri
/oauth2/request.jwt/{id}:
/oauth2/{did}/request.jwt/{id}:
Copy link
Member Author

@gerardsn gerardsn May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically we don't need the DID in the path, but all other /oauth2/... have it...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same applies to a OpenID4VCI endpoint, so I don't think it needs to be per se. One more thing to validate...

@gerardsn gerardsn requested a review from reinkrul May 2, 2024 13:37
@gerardsn gerardsn marked this pull request as ready for review May 3, 2024 13:21
@gerardsn gerardsn force-pushed the feature/refactor-JAR-to-interface branch from 5ad2553 to dfc259f Compare May 3, 2024 13:22
@gerardsn gerardsn merged commit 760f130 into master May 5, 2024
8 of 9 checks passed
@gerardsn gerardsn deleted the feature/refactor-JAR-to-interface branch May 5, 2024 14:07
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