Skip to content

Make set_issuer and set_audience require aud, iss claims#520

Open
mikkel3000 wants to merge 1 commit into
Keats:masterfrom
mikkel3000:feature/493-set_spec_claims
Open

Make set_issuer and set_audience require aud, iss claims#520
mikkel3000 wants to merge 1 commit into
Keats:masterfrom
mikkel3000:feature/493-set_spec_claims

Conversation

@mikkel3000

Copy link
Copy Markdown

Addresses #493

set_audience and set_issuer convenience functions now adds aud and iss to required_spec_claims.

@mikkel3000 mikkel3000 force-pushed the feature/493-set_spec_claims branch from e73b62c to a5a4aab Compare June 18, 2026 16:52
@arckoor arckoor self-requested a review June 18, 2026 17:13

@arckoor arckoor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should be fine, without some more doc on set_required_spec_claims opens up the door for another footgun because that method unconditionally overwrites everything, it's not additive.
The entire interface is imo weirdly split between using methods on Validation, and setting some attributes directly. Thoughts @Keats?

Comment thread src/validation.rs Outdated
Comment on lines -856 to -821
validation.set_required_spec_claims(&["exp", "iss"]);
validation.leeway = 5;
validation.set_issuer(&["iss no check"]);
validation.set_audience(&["iss no check"]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could be augmented by not adding "iss" manually
Though then you can just remove the entire set_required_spec_claims

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay, updated the PR.

@Keats

Keats commented Jun 20, 2026

Copy link
Copy Markdown
Owner

The entire interface is imo weirdly split between using methods on Validation, and setting some attributes directly. Thoughts @Keats?

The API of the Validation struct is a bit confusing IMO (and has been adding things without too much thought put into it) and was always something I wanted to redo but never spent time on. It would be good to see what something designed from scratch for all the current features would look like.

Addresses Keats#493

set_audience and set_issuer convenience functions now adds `aud` and `iss` to `required_spec_claims`.
@mikkel3000 mikkel3000 force-pushed the feature/493-set_spec_claims branch from a5a4aab to 6f4a9d5 Compare June 21, 2026 07:19
@mikkel3000

Copy link
Copy Markdown
Author

The entire interface is imo weirdly split between using methods on Validation, and setting some attributes directly. Thoughts @Keats?

The API of the Validation struct is a bit confusing IMO (and has been adding things without too much thought put into it) and was always something I wanted to redo but never spent time on. It would be good to see what something designed from scratch for all the current features would look like.

Does that mean you do not want to use this change, and wait for a larger refactor of the validation API?
I agree that the API is confusing, but i think a proper re-implementation would (and should) bring multiple breaking changes.

@Keats

Keats commented Jun 22, 2026

Copy link
Copy Markdown
Owner

I agree that the API is confusing, but i think a proper re-implementation would (and should) bring multiple breaking changes.

There is a new major version coming so it would be fine.
I won't have time to implement it myself but would happily review it if someone else does it.

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.

3 participants