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

Replace Endpoint middleware concept with Security concept #2888

Closed
jdegoes opened this issue Jun 6, 2024 · 12 comments · Fixed by #2947
Closed

Replace Endpoint middleware concept with Security concept #2888

jdegoes opened this issue Jun 6, 2024 · 12 comments · Fixed by #2947
Labels

Comments

@jdegoes
Copy link
Member

jdegoes commented Jun 6, 2024

Right now, we cannot enforce that endpoint middleware is actually implemented (it's a very complicated problem that cannot be solved in time for release). Simultaneously, we cannot document security requirements of endpoints.

To fix this issue, we should instead use a sealed trait AuthType, or similar, which is placed into Endpoint. Based on this, we can generate OpenAPI documentation, as well as potentially even leverage this information in the automatic HTTP client.

sealed trait AuthType {
  type ClientRequirements
  type ServerRequirements
}
object AuthType {
  case object Basic extends AuthType {
    type ClientRequirements = ...
    type ServerRequirements = ...
  }
  ... 
}

Note that endpoint auth type would still be a type parameter, albeit constrained (Z <: AuthType). The reason is to statically retain the type members inside the AuthType value, so they can be used by client and server.

This requires more R&D but should address all of the issues with endpoint middleware that we have, currently. The question is, can we do it in time? 😄

@jdegoes jdegoes added the enhancement New feature or request label Jun 6, 2024
@jdegoes
Copy link
Member Author

jdegoes commented Jun 6, 2024

/bounty $1500

Copy link

algora-pbc bot commented Jun 6, 2024

💎 $1,500 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2888 with your implementation plan
  2. Submit work: Create a pull request including /claim #2888 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @987Nabil Jun 6, 2024, 7:04:48 PM #2947
🔴 @promisingcoder Jul 2, 2024, 10:05:25 PM WIP

@987Nabil
Copy link
Contributor

987Nabil commented Jun 6, 2024

/attempt

Algora profile Completed bounties Tech Active attempts Options
@987Nabil    35 ZIO bounties
+ 1 bounty from 1 project
Scala
Cancel attempt

Copy link

algora-pbc bot commented Jun 13, 2024

@987Nabil: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Copy link

algora-pbc bot commented Jun 20, 2024

The bounty is up for grabs! Everyone is welcome to /attempt #2888 🙌

@987Nabil
Copy link
Contributor

/attempt

@987Nabil
Copy link
Contributor

Will be streaming the impl. tomorrow or on the weekend

@promisingcoder
Copy link

promisingcoder commented Jul 2, 2024

/attempt #2888

Copy link

algora-pbc bot commented Jul 8, 2024

💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Jul 9, 2024

@promisingcoder: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

Copy link

algora-pbc bot commented Jul 16, 2024

The bounty is up for grabs! Everyone is welcome to /attempt #2888 🙌

987Nabil added a commit to 987Nabil/zio-http that referenced this issue Aug 15, 2024
jdegoes pushed a commit that referenced this issue Aug 15, 2024
Rework Endpoint authentication (#2888)
Copy link

algora-pbc bot commented Aug 15, 2024

🎉🎈 @987Nabil has been awarded $1,500! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants