Code Monkey home page Code Monkey logo

bridgetown-deploy_hook's People

Contributors

michaelherold avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

bridgetown-deploy_hook's Issues

Allow for authenticating requests outside of the Authorization header

Some systems, like Netlify's deploy notifications use alternative means of authentication like signed payloads. This means that authorization should have access to more than just the Authorization header.

I propose sending either:

  1. The whole request to the authorizer
  2. The (nilable) authorization header and the request
  3. Both of the above

The frustrating part of (3) is that we would either need to have complex dispatching logic or cumbersome ignored parameters for stabby lambdas. We could wrap the whole thing in an "authorization request" like:

AuthorizationRequest = Struct.new(:params, :request, :scheme, keyword_init: true)

but this makes one-liners a bit hard to read by changing:

{
  authorization: {
    bearer: ->(token) { token == ENV["MY_TOKEN"] }
  }
}

into:

{
  authorization: ->(auth) { auth.scheme == "Bearer" && auth.params == ENV["MY_TOKEN"] }
}

but I think that's probably okay. More complexity is probably not necessary or wanted; having an authorizer be a few lines isn't a bad thing and might push people to use objects instead of lambdas.

Note that this will be a breaking change which is okay since we're still in pre-1.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.