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: Add SIOP Request features #17

Merged
merged 30 commits into from
Apr 25, 2023
Merged

feat: Add SIOP Request features #17

merged 30 commits into from
Apr 25, 2023

Conversation

nanderstabel
Copy link
Collaborator

@nanderstabel nanderstabel commented Apr 14, 2023

Description of change

This PR adds the following features:

  • A new RequestUrl enum type with two variants: one for a request by value ( the SiopRequest), and another for a request by reference. This last variant is defined by the request_uri parameter in the request url.
  • A RequestUrlBuilder which enables easy construction of request urls.
  • A separate validate_request() method for Provider. This method extracts the SiopRequest from the RequestUrl and does some validation of the contents.
  • Support for the registration parameter. This includes proper serialization and deserialization to and from literal formencoded request urls. The serde_urlencoded crate does not support serialization for non-primitive types (in this case, Registration is a custom struct with array fields).
  • The decode method for the Validator trait which enables validating a JWT using a designated public key.
  • The skeptic crate which enables testing of example code in markdown files.
  • Improved the README example and the RelyingParty tests by utilizing a wiremock mock server.

Links to any relevant issues

fixes #12
fixes #13
fixes #14
fixes #16

How the change has been tested

  • Tested successfully locally against the formed Sphereon Demo website.
  • Existing unit tests are updating in order to parse raw request urls (including the siopv2://idtoken? prefix) to the new RequestUrl type. The division of the new Provider::validate_request() method is also reflected in the unit tests.
  • Added multiple tests for valid and invalid RequestUrls of both variants.
  • Added multiple tests for valid and invalid RequestUrlBuilders.
  • Added a tests directory which includes a new skeptic.rs file for testing the rust example in the README file.
  • Utilized the wiremock mock server for the README example and RelyingParty unit test.

Definition of Done checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@nanderstabel nanderstabel added Added A new feature that requires a minor release. Enhancement New feature or improvement to an existing feature labels Apr 14, 2023
Copy link

@daniel-mader daniel-mader left a comment

Choose a reason for hiding this comment

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

Awesome work! 🥳

src/id_token.rs Show resolved Hide resolved
src/response.rs Show resolved Hide resolved
src/subject.rs Show resolved Hide resolved
src/request.rs Show resolved Hide resolved
src/request.rs Show resolved Hide resolved
src/request.rs Outdated Show resolved Hide resolved
@nanderstabel nanderstabel merged commit b73eb5e into dev Apr 25, 2023
@nanderstabel nanderstabel deleted the feat/request-uri branch April 25, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added A new feature that requires a minor release. Enhancement New feature or improvement to an existing feature
Projects
None yet
2 participants