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: Added network interceptor hook #386

Merged
merged 10 commits into from
Nov 6, 2023

Conversation

IamMayankThakur
Copy link
Contributor

@IamMayankThakur IamMayankThakur commented Nov 3, 2023

Summary of change

Added network interceptor hook. This can be used to capture/modify all the requests sent to the core.

Related issues

Test Plan

Added unit test to test the flow.
Further unit tests may need to be added to test the flow when the request object is modified.

Documentation changes

  • Need to add docs for this feature

Checklist for important updates

  • Changelog has been updated
  • coreDriverInterfaceSupported.json file has been updated (if needed)
    • Along with the associated array in supertokens/constants.go
  • frontendDriverInterfaceSupported.json file has been updated (if needed)
  • Changes to the version if needed
    • In supertokens/constants.go > version variable
  • Had installed and ran the pre-commit hook
  • If new thirdparty provider is added,
    • update switch statement in recipe/thirdparty/providers/config_utils.go file, createProvider function.
    • add an icon on the user management dashboard.
  • Issue this PR against the latest non released version branch.
    • To know which one it is, run find the latest released tag (git tag) in the format vX.Y.Z, and then find the latest branch (git branch --all) whose X.Y is greater than the latest released tag.
    • If no such branch exists, then create one from the latest released branch.
  • If access token structure has changed
    • Modified test in session/accessTokenVersions_test.go to account for any new claims that are optional or omitted by the core

Remaining TODOs for this PR

  • Update docs

supertokens/querier.go Outdated Show resolved Hide resolved

assert.Equal(t, 200, res.StatusCode)
assert.Equal(t, false, isNetworkIntercepted)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • add a test where you modify the url of the request to the core, and then check that the function call to signIn returns an error with the right content (should have 404 status code, or the message should have a 404).

  • add a test where you modify the query params of the request to the core, and then check that the function to a GET request (like list roles for users), returns a 400 from the core

  • add a test where you modify the request body and then check that the function call to the core returns a 400

@IamMayankThakur IamMayankThakur changed the title Added network interceptor hook feat:Added network interceptor hook Nov 6, 2023
upgraded go version to go1.18
@IamMayankThakur IamMayankThakur changed the title feat:Added network interceptor hook feat: Added network interceptor hook Nov 6, 2023
@rishabhpoddar rishabhpoddar merged commit 7632d2f into 0.16 Nov 6, 2023
4 of 6 checks passed
@rishabhpoddar rishabhpoddar deleted the feat/network-interceptor-hook branch November 6, 2023 18:37
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