Where should auth credentials be stored (e.g oauth2 access token)? #675
-
Hey there, I'm a bit confused about Here's my use case:
Based on my current understanding there are two options for storing the auth credentials with Serverless DSL:
Questions:
I can see that there was another discussion on this and someonee suggested here to separate This suggestion looks very close to what I'm trying to achieve. Any chance this is part of the spec now? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @giorgosera! You can use In the OAuth2 flow, if I understood your question correctly, to me it seems that your underneath implementation should use the In the OpenAPI definition, you will see that each operation describes how to properly call it security-wise. So the workflow author shouldn't need to define yet another argument to call the function. Every information needed is supposed to be there. An example: {
"functions": [{ "operation": "withauthopenapi.yaml#securedOperation", "name": "securedFunction",
"authRef": { // OAuth2 definition, with the token via $SECRETS example:
"username": "alice",
"password": "{ $SECRET.mypassword }"
}
}],
"states": [{
"type": "operation",
"actions": [
{
"functionRef": {
"refName": "securedFunction",
"arguments": {
"arg1": "${ .arg1 }"
}
}
}
}]
} The The |
Beta Was this translation helpful? Give feedback.
-
If you want to store a token directly, you can:
...
auth:
- name: MyBearerAuth
scheme: bearer
properties:
token: 'MyJwtToken'
...
...
auth:
- name: MyOAUTH2
scheme: oauth2
properties:
authority: http://myauthority.com
grant_type: urn:ietf:params:oauth:grant-type:token-exchange
subject_token: "USER_ACCESS_TOKEN"
... |
Beta Was this translation helpful? Give feedback.
If you want to store a token directly, you can:
bearer
authentication scheme:properties
of an AuthDef to the name of the secret that contains the expected data (i.e.{ "token": "MyToken" }
)client_credentials
flow, or, in your case,…