-
Notifications
You must be signed in to change notification settings - Fork 134
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
Authenticated routes for scala-http4s plugin #1409
Comments
@kyri-petrou Great timing! @zeal18 has been diligently working on this over in #1342. It's nearly complete, and if you don't mind switching to running the It would be great to have some more eyes on the approach we took, as well as to confirm the ergonomics is pleasant to use. If you clone the guardrail repo, switch to @zeal18's branch, then run:
you'll get a server generated using one of the sample specs we have for regression tests. By adjusting the locations of the different parameters to this sample CLI call (and temporarily disabling the build tool plugin you're using) you can test the generated code in your own project. Please do report back and let us know what you think! |
Ah, perfect! I'll give it a go and let you know how it goes. Are you happy to keep this issue open for me to report any feedback or is there somewhere else I can do that? |
@kyri-petrou I'm fine either way -- that issue and #1407 are top-of-mind for me currently, so no matter where you provide feedback (even in the gitter channel) it'll be fine. The next release will include some minor but necessarily breaking changes to generated code, so even after that PR gets merged, I'll still be playing around with the UX before cutting the next minor release. |
Got a couple of questions if that's okay:
|
|
Awesome, thanks. From a UX perspective, I think l to be able to reuse authentication middleware(s), as this will also allow to seamlessly integrate with 3rd party libraries (e.g., http4s-jwt-auth) As for (2) I've modified openapi: 3.0.2
info:
title: Test for security support
version: 1.0.0
paths:
/foo:
post:
x-jvm-package: auth
operationId: doFoo
requestBody:
required: true
content:
application/json:
schema:
type: string
responses:
200:
description: ""
content:
application/json:
schema:
type: string
/bar:
post:
x-jvm-package: auth
operationId: doBar
requestBody:
required: true
content:
application/sdp:
schema:
type: string
responses:
200:
description: ""
content:
application/json:
schema:
type: string
/baz:
post:
x-jvm-package: auth
operationId: doBaz
requestBody:
required: true
content:
application/sdp:
schema:
type: string
responses:
200:
description: ""
content:
application/json:
schema:
type: string
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-KEY
# The API key is required / applied globally to all operations
security:
- ApiKeyAuth: [] |
I think in this case it's better to switch off guardrail's authentication and use For me, adopting the
Summarising, I would suggest you to use pure http4s
and enable guardrail authentication if:
P.S.: the last point could become another option of the guardrail's authentication: just to enable |
Yeah I think that would be really good. The main issue I had using an |
nice, I'll try to workaround this soon |
I've tried the experimental plugin out quite a bit, and I'm quite happy with it overall! I think the only other comment I really have is maybe if there was a way to have a default response on unauthenticated calls instead of having to implement the response explicitly in every route, but that's quite minor. Well done! |
Hi @kyri-petrou! I've implemented the idea we discussed above, check it out: #1342 |
Resolved with #1342, pending release |
Oops I must have missed the notification on this one. Awesome, I'll check it out!
🙌 |
Hello there 👋
I'm a huge fan of this project and really appreciative of all the work that went into developing it - you guys rock 🎸
I was wondering whether there are plans to add support for Authenticated routes for the http4s plugin. Please excuse me it's already supported, I couldn't find anything in the docs or source code to indicate as such - if that's the case, a link to some doco or some basic instructions would be very much appreciated!
Thanks again!
The text was updated successfully, but these errors were encountered: