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

Add support for custom middleware to handle unauthorized. #24

Closed
wants to merge 14 commits into from

Commits on May 30, 2019

  1. Configuration menu
    Copy the full SHA
    9161397 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f4814f View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2021

  1. feat: enable custom unauthorized handling via middleware

    Current behavior supports:
    - string, rendered as text in response
    - object, rendered as JSON object in response
    
    This enhancement enables passing a normal middleware. It allows full customization of the response handling in the case of unauthorized:
    ```JavaScript
      app.use(basicAuth({
        unauthorizedResponse: function(req, res, next) {
          // use an application's existing error handling stack
          if (req.auth) {
            next(new UnauthorizedError('Login required'));
            return;
          }
          // or send an html page
          if (req.accepts('html') {
            res.render('unauthorized');
            return;
          }
          // or whatever you like!
          res.status(403)
            send({
              message: 'That user will NEVER have access. Ever!'
            });
        }
      }));
    ```
    
    fixes LionC#23
    matmar10 committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    8d3c2e1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7a97797 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2021

  1. Configuration menu
    Copy the full SHA
    48d7041 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e13b2d6 View commit details
    Browse the repository at this point in the history
  3. Release 1.3.0

    matmar10 committed Aug 7, 2021
    Configuration menu
    Copy the full SHA
    192e8ca View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fdab80c View commit details
    Browse the repository at this point in the history
  5. Release 1.3.1

    matmar10 committed Aug 7, 2021
    Configuration menu
    Copy the full SHA
    9839c97 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    72bf15b View commit details
    Browse the repository at this point in the history
  7. Release 1.3.2

    matmar10 committed Aug 7, 2021
    Configuration menu
    Copy the full SHA
    a922028 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3ac09ed View commit details
    Browse the repository at this point in the history
  9. ci: remove typescript compiler check from build test

    The typescript check seems out of date, since it's currently failing with hundreds of errors. Further investigation is needed to re-enabe this. Better to disable for now and have the build run successfully on the core codebase.
    matmar10 committed Aug 7, 2021
    Configuration menu
    Copy the full SHA
    2579b12 View commit details
    Browse the repository at this point in the history
  10. Release 1.3.3

    matmar10 committed Aug 7, 2021
    Configuration menu
    Copy the full SHA
    38ef684 View commit details
    Browse the repository at this point in the history