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

Test/add oauth2 cases #88

Closed
wants to merge 8 commits into from
Closed

Test/add oauth2 cases #88

wants to merge 8 commits into from

Commits on May 21, 2024

  1. Refactor ESLint configuration and improve OAuth2 node functionality

     - Update ESLint configuration to include Prettier plugin and adjust rules for code style consistency.
     - Add browser and mocha environments to ESLint configuration.
     - Remove unused crypto and circular reference replacer from oauth2.js.
     - Simplify axios POST request logic and add proxy support in OAuth2 node.
     - Include response headers in the message payload for better context.
     - Adjust tests to reflect changes in oauth2.js and reduce timeout for faster test execution.
     - Add new test cases for handling different grant types, network failures, custom headers, multiple scopes, and proxy settings.
    caputomarcos committed May 21, 2024
    Configuration menu
    Copy the full SHA
    f1f29e5 View commit details
    Browse the repository at this point in the history
  2. remove diff

    caputomarcos committed May 21, 2024
    Configuration menu
    Copy the full SHA
    dba9040 View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. Update dependencies and refactor OAuth2 node

     - Updated the `oauth2.js` node to handle additional edge cases and improve error handling.
     - Refactored `logger.js` for better readability and consistency.
     - Added new test cases in `oauth2_spec.js` to cover more scenarios and ensure robustness.
     - Removed unused dependencies and cleaned up `package.json` and `yarn.lock` files.
     - Adjusted the `package.json` scripts to include a new `coverage` script for test coverage reporting.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    ab15569 View commit details
    Browse the repository at this point in the history
  2. Refactor oauth2.json and oauth2.html for clarity and add debug mode

     This commit introduces several changes to improve the clarity and functionality of the oauth2 configuration. In the oauth2.json locale file, the tips for debug mode, client credentials, and
     rejectUnauthorized have been added, and the labels have been updated to be more concise. The oauth2.html file has been updated to include a new debug mode checkbox with corresponding help information, a
     the labels for client credentials and rejectUnauthorized have been adjusted to match the updated locale file.
    
     Additionally, the logger.js file has been removed as it appears to be no longer needed, and the corresponding references to the logger have been added to the oauth2.js file to incorporate logging
     functionality directly within the OAuth2 node implementation. The debug mode can now be toggled via the node configuration, and the logger is initialized with the debug setting from the config.
    
     Lastly, the oauth2.js file has been refactored to include more descriptive logging messages that will aid in debugging and understanding the flow of the OAuth2 node's operations.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    a217097 View commit details
    Browse the repository at this point in the history
  3. Add refresh token support and refactor oauth2 node options

     This commit introduces several changes to the oauth2 node configuration and handling of OAuth2 flows. The primary addition is the support for the refresh token grant type, which allows the node to obtai
     new access tokens using a refresh token.
    
     Key changes include:
     - Added a new `refresh_token` field in the oauth2.html file to allow users to input their refresh token.
     - Updated oauth2.js to handle the new refresh token flow, including generating the appropriate form data and handling the client credentials.
     - Refactored the `generateOptions` function in oauth2.js to improve readability and maintainability. The function now uses a mapping of grant type to specific handling functions.
     - Updated the logger.js to allow for an undefined `count` parameter, which means logging will not be limited unless specified.
     - Enhanced the localization file (oauth2.json) to include the new refresh token field.
    
     These changes aim to enhance the node-red-contrib-oauth2 package by providing a more comprehensive and user-friendly OAuth2 implementation.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    c6f96af View commit details
    Browse the repository at this point in the history
  4. Update dependencies and adjust code for compatibility

     This commit updates several dependencies to their latest versions, including axios, eslint, and prettier. It also includes adjustments to the codebase to ensure compatibility with the updated
     dependencies. Notably, the eslint-plugin-n and eslint-plugin-jsdoc have been updated, which required changes to the eslint configuration. Additionally, the Logger.prototype.objectDump method in logger.j
     has been modified to handle invalid objects more gracefully.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    fe2bcd7 View commit details
    Browse the repository at this point in the history
  5. Remove unused 'should' require in oauth2-generate-options tests

     The 'should' library was included in the oauth2-generate-options_spec.js file but was not being used. This commit removes the unnecessary require statement to clean up the code.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    85d90aa View commit details
    Browse the repository at this point in the history
  6. Improve error handling and remove unused URL import in oauth2.js

     - Removed the unused URL import from oauth2.js.
     - Added URLSearchParams import for handling form data.
     - Wrapped the credentials retrieval in a try-catch block to handle potential errors.
     - Changed the response status code to 404 when credentials are not found.
     - Changed the response status code to 500 for server errors.
     - Updated the success HTML response to use proper indentation and formatting.
     - Changed the response status code to 400 when credentials are missing in the token exchange endpoint.
    caputomarcos committed May 23, 2024
    Configuration menu
    Copy the full SHA
    9621caf View commit details
    Browse the repository at this point in the history