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(jans-cedarling): implement validation for userinfo_token JWT #9939

Merged
merged 84 commits into from
Oct 30, 2024

Commits on Oct 20, 2024

  1. feat(jans-cedarling): implement KeyService for JwtService

    - implemented a `KeyService` for `JwtService` that manages decoding keys
      which are used to validate Json Web Tokens (JWTs).
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    860ba3b View commit details
    Browse the repository at this point in the history
  2. feat(jans-cedarling): implement GetKey for KeyService

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    e47e657 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e40c80b View commit details
    Browse the repository at this point in the history
  4. feat(jans-cedarling): replace custom mockhttp with mockito and refact…

    …or services
    
    - Replaced custom `mockhttp` with `mockito` for simulating HTTP requests in tests.
    - Refactored `JwtService` and `KeyService` to remove the need for the `GetKey` trait.
      `KeyService` can now be initialized directly, simplifying the code and improving clarity.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    e639073 View commit details
    Browse the repository at this point in the history
  5. refactor(jans-cedarling): restructure folder layout, improve document…

    …ation, and simplify services
    
    - restructured the folder structure in the /jwt module for better organization.
    - added comprehensive docstrings to enhance code readability and maintainability.
    - simplified KeyService and DecodingStrategy by removing unnecessary traits for their communication.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    7ec377c View commit details
    Browse the repository at this point in the history
  6. chore(jans-cedarling): move mockito from dependencies to dev-dependen…

    …cies for cleaner build
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    2257511 View commit details
    Browse the repository at this point in the history
  7. merge: branch 'main' into jans-cedarling-9814

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    5e14b5e View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2024

  1. Configuration menu
    Copy the full SHA
    4e2d45d View commit details
    Browse the repository at this point in the history
  2. feat(jans-cedarling): reuse HTTP client and switch to eprintln for er…

    …ror logging
    
    - reuse a HTTP client initialized on init for `KeyService` when making requests to improve efficiency
    - replaced `println!` with `eprintln!` for better error logging
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    7976b58 View commit details
    Browse the repository at this point in the history
  3. feat(jans-cedarling): implement custom error handling for lock acquis…

    …ition failure
    
    - added error handling for cases where acquiring a lock on decoding keys fails
    - replaced `unwrap()` with a custom error to handle poisoned locks gracefully
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    460bc0b View commit details
    Browse the repository at this point in the history
  4. feat(jans-cedarling): implement validation for userinfo_token

    - validate the `userinfo_token` to ensure its integrity and correctness
    - verify that the `client_id` of the `userinfo_token` matches the `aud` of the corresponding `access_token`
    - verify that the `sub` of the `userinfo_token` matches the `sub` of the corresponding `id_token`
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    366050c View commit details
    Browse the repository at this point in the history
  5. feat(jans-cedarling): update token examples in /examples directory

    - revise example tokens to reflect current requirements
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    87d4f68 View commit details
    Browse the repository at this point in the history
  6. chore(jans-cedarling): remove unused fields from tokens in jwt::token

    - clean up the `jwt::token` module by removing fields that are unused.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    01dd8b5 View commit details
    Browse the repository at this point in the history
  7. feat(jans-cedarling): implement specific error messages for invalid t…

    …oken types
    
    - introduced `InvalidAccessToken` error for invalid access tokens
    - introduced `InvalidIdToken` error for invalid ID tokens
    - introduced `InvalidUserinfoToken` error for invalid userinfo tokens
    - this change provides clearer feedback based on the type of invalid token encountered
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    e60a4f2 View commit details
    Browse the repository at this point in the history
  8. docs: changes in policy store docs

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    b5e00a1 View commit details
    Browse the repository at this point in the history
  9. feat(jans-cedarling): implement Deserialize for TokenKind

    - implement Deserialize for TokenKind instead of using the
      derialize_with macro
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    0b2128f View commit details
    Browse the repository at this point in the history
  10. refactor(jans-cedarling): move test mod from init/test.rs into init/p…

    …olicy_store.rs
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    b600fdb View commit details
    Browse the repository at this point in the history
  11. test(jans-cedarling): remove redundant assert in errors_on_multiple_m…

    …appings
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    53b4f70 View commit details
    Browse the repository at this point in the history
  12. feat(jans-cedarling): implement Copy trait for TokenKind enum

    - added the Copy trait implementation to TokenKind for more efficient value handling
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    98c50fb View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    24b2088 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2024

  1. refactor(jans-cedarling): change MultipleRoleMappings error to use Ve…

    …c<String>
    
    - updated the MultipleRoleMappings error variant to store a Vec<String>
      instead of a single String, allowing it to capture multiple tokens with role mappings.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    782bcee View commit details
    Browse the repository at this point in the history
  2. refactor(jans-cedarling): rename fields in PolicyStore to be more des…

    …criptive
    
    - rename `schema` field in `PolicyStore` to `cedar_schema`
    - rename `policies` field in `PolicyStore` to `cedar_policies`
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    7bf7adf View commit details
    Browse the repository at this point in the history
  3. refactor(jans-cedarling): improve naming and deserialization for Poli…

    …cyStore
    
    - policy_store_id is now only required when loading from Lock Master, simplifying the structure of policy_store.json
    - renamed and simplified field and function names for better clarity in policy deserialization
    - updated docstrings to enhance understanding of PolicyStore fields and deserialization process
    - updated test cases to reflect new naming conventions and improve error handling
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    2709358 View commit details
    Browse the repository at this point in the history
  4. feat(jans-cedarling): introduce cedar_version field in policy_store.json

    - added support for the cedar_version field to specify the version of Cedar being used.
    - this enhancement allows for version-specific parsing of schemas and policies during deserialization.
    - updated relevant structures and deserialization logic to validate the cedar_version format.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    55dfa50 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    90c7bdc View commit details
    Browse the repository at this point in the history
  6. refactor(jans-cedarling): move deserialization logic for multiple rol…

    …es to PolicyStore
    
    - checking for multiple roles now occurs during the deserialization of PolicyStore
    - the corresponding test has been relocated from `init/policy_store.rs` to
      `common/policy_store.rs` for better organization and clarity.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    bcb0e43 View commit details
    Browse the repository at this point in the history
  7. refactor(jans-cedarling): rename parse_policy to parse_single_policy

    - rename `parse_policy` to `parse_single_policy` to make the intent of
      calling the function clearer
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    5f1c19b View commit details
    Browse the repository at this point in the history
  8. docs: fixing review comments

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    1bf5bf7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2f831ca View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    fde6270 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    6c70fa5 View commit details
    Browse the repository at this point in the history
  12. docs: fixing review comments

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    0221382 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    37ea3fd View commit details
    Browse the repository at this point in the history
  14. docs: correct policy store format

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    3178f68 View commit details
    Browse the repository at this point in the history
  15. docs: correct policy store format

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    9692d6c View commit details
    Browse the repository at this point in the history
  16. docs: correct policy store format

    Signed-off-by: Arnab Dutta <[email protected]>
    duttarnab committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    7a4db0a View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2024

  1. fix(jans-cedarling): remove unused commented code

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    3b7dae6 View commit details
    Browse the repository at this point in the history
  2. docs(jans-cedarling): fix docstrings in PolicyStore

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    208596a View commit details
    Browse the repository at this point in the history
  3. chore(jans-cedarling): renamed check_token_metadata to `parse_and_c…

    …heck_token_metadata`
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    df336b1 View commit details
    Browse the repository at this point in the history
  4. refactor(jans-cedarling): replace custom version parsing with the sem…

    …ver crate
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    f07fcc2 View commit details
    Browse the repository at this point in the history
  5. refactor(jans-cedarling): simplify TokenKind parsing

    - removed the need for a Visitor in parsing logic
    - users now pass `access_token`, `id_token`, `userinfo_token`,
      or `transaction_token` (case-insensitive) as the token type
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a5abfd9 View commit details
    Browse the repository at this point in the history
  6. chore(jans-cedarling): simplify policy parsing by removing unnecessar…

    …y Ok wrapper
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    e36f963 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f9f67d4 View commit details
    Browse the repository at this point in the history
  8. chore(jans-cedarling): replace string with JSON macro for invalid tok…

    …en metadata test
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    33315bc View commit details
    Browse the repository at this point in the history
  9. feat(jans-cedarling): enhance policy deserialization error handling

    - updated the deserialization logic to collect and report multiple errors encountered during policy parsing
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    cc062d2 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c500ca0 View commit details
    Browse the repository at this point in the history
  11. fix(jans-cedarling): resolve merge conflicts between jans-cedarling-i…

    …ssue-9901 and jans-cedarling-9905
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    fd635ea View commit details
    Browse the repository at this point in the history
  12. test(jans-cedarling): move tests to a separate file and enhance input…

    … clarity
    
    - reorganized tests into a dedicated file for better structure
    - improved readability of policy and schema inputs in the tests
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    1c5f33f View commit details
    Browse the repository at this point in the history
  13. chore(jans-cedarling): resolve Clippy warnings

    - fixed needless borrows to improve code efficiency
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    a1360cb View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    7a3ac9a View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    26b8cb4 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2024

  1. merge: branch 'main' into jans-cedarling-9905

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    bb83394 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    acf70f2 View commit details
    Browse the repository at this point in the history
  3. chore(jans-cedarling): add comments to the tokens in the examples

    - added comments so it's obvious what's in the claims in the tokens
      string in the examples directory
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    d5632af View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9b39d16 View commit details
    Browse the repository at this point in the history
  5. chore(jans-cedarling): update incorrect docstrings

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    435a418 View commit details
    Browse the repository at this point in the history
  6. merge: branch 'main' into jans-cedarling-9832

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    885b844 View commit details
    Browse the repository at this point in the history
  7. chore(jans-cedarling): resolve clippy warnings

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    77823a6 View commit details
    Browse the repository at this point in the history
  8. refactor(jwt): convert extract_claims to an associated function

    - moved the `extract_claims` function out of the method that uses `self`,
      making it an associated function to avoid unnecessary usage of `self`
      while preserving organization within the impl block.
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    b1a5d10 View commit details
    Browse the repository at this point in the history
  9. refactor(jans-cedarling): revert to custom Error for unsupported algo…

    …rithm parsing
    
    - manually reverted to returning a custom Error when parsing an
      unsupported algorithm, preserving previous error reporting behavior
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    c8c8945 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2024

  1. merge: branch 'main' into jans-cedarling-9814

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 27, 2024
    Configuration menu
    Copy the full SHA
    ae9a250 View commit details
    Browse the repository at this point in the history
  2. chore(jans-cedarling): fix clippy warnings

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 27, 2024
    Configuration menu
    Copy the full SHA
    1128c8d View commit details
    Browse the repository at this point in the history
  3. docs(jans-cedarling): fix wrong example in the docs

    - renamed `person_id` to `user_id` in the example
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 27, 2024
    Configuration menu
    Copy the full SHA
    0407e39 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    67c233c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a626c7c View commit details
    Browse the repository at this point in the history
  6. merge: branch 'main' into jans-cedarling-9905

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 27, 2024
    Configuration menu
    Copy the full SHA
    6f7bba6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    635fd96 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    aa0ca33 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2024

  1. chore(jans-cedarling): replace person_id with user_id

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    d50c9d9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    263f279 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4e3f0c8 View commit details
    Browse the repository at this point in the history
  4. merge: branch 'main' into jans-cedarling-9814

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    b974f5b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ed081a1 View commit details
    Browse the repository at this point in the history
  6. merge: branch 'main' into jans-cedarling-9832

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    faa4f90 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2024

  1. chore(jans-cedarling): remove unused traits file

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    6d5a976 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f0fec48 View commit details
    Browse the repository at this point in the history
  3. docs(jans-cedarling): update README.md

    - update README to show how to run the new tests
    
    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    aa1e863 View commit details
    Browse the repository at this point in the history
  4. feat(jans-cedarling): improve error handling

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    fb93439 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f90b486 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    58febd3 View commit details
    Browse the repository at this point in the history
  7. test(jans-cedarling): fix python unit tests

    Signed-off-by: Oleh Bohzok <[email protected]>
    olehbozhok committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    334f5a9 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2024

  1. chore(jans-cedarling): fix misspelled test function name

    Signed-off-by: rmarinn <[email protected]>
    rmarinn committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    8860caf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    01bc63b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    18ea57d View commit details
    Browse the repository at this point in the history