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

Define function input schemas for operations with securitySchemes #806

Closed
paarthdassani opened this issue Dec 19, 2023 · 7 comments
Closed
Milestone

Comments

@paarthdassani
Copy link

What would you like to be added:
An implicit schema should be defined for the function arguments based on the securitySchemes defined in the asyncapi/openapi operation.

Why is this needed:
Different securitySchemes entail different types of inputs from the users.
Eg: basic auth scheme in the openapi spec should translate to "username" and "password" input keys in the function arguments. The runtime should then handle them as defined by the openapi spec.

There could be different such expected inputs for different securitySchemes.
Leaving these to the implementations could affect portability across runtimes, so there should be some behavior defined by the spec to handle these.

@ricardozanini ricardozanini added the area: spec Changes in the Specification label Dec 19, 2023
@ricardozanini ricardozanini added this to the v0.9 milestone Dec 19, 2023
@ricardozanini ricardozanini self-assigned this Dec 21, 2023
Copy link

github-actions bot commented Feb 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Copy link

github-actions bot commented May 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@cdavernas
Copy link
Member

cdavernas commented May 17, 2024

@paarthdassani First of all, sorry we could not address your issue sooner, we had our hands full with upcoming refactor.

As we are finishing up modelling the 1.0.0-alpha1, I want to make sure it covers what you need/are asking for.

An implicit schema should be defined for the function arguments based on the securitySchemes defined in the asyncapi/openapi operation.

What do you mean exactly with that? I'm not sure I understand. You want to add a way to set the parameters of the security scheme defined in the OpenAPI document? If so, then you probably hould use an authentication policy.

As of now, authentication in ServerlessWorkflow is declarative, not dynamic. This means that, even though you are calling an OpenAPI function that is documented to be protected by, say, basic authentication, Serverless Workflow mandates that you declare it as the function's authentication policy. As a result, runtimes should not pay attention to authentication mechanisms documented in the OpenAPI doc.

The main reason behind it is that, by definition, OpenAPI only documents said schemes, and does not, obviously, configure it, which forces you to declare some (potentially arbitrary) parameters (like username and password) in the function call... that's exactly what can be achieved using an Authentication Policy, which defines, for each supported scheme, the schemas I believe you are speaking about.

@ricardozanini ricardozanini removed the area: spec Changes in the Specification label May 17, 2024
@ricardozanini ricardozanini removed their assignment May 17, 2024
@paarthdassani
Copy link
Author

Thanks @ricardozanini for the response! Runtime relying on the authentication policy works.

@cdavernas
Copy link
Member

@paarthdassani you meant @cdavernas? 🤣

@paarthdassani
Copy link
Author

Oops :)
Thanks @cdavernas

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

No branches or pull requests

3 participants