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

Support authentication through payas-test module #61

Closed
3 tasks
ramnivas opened this issue Jun 17, 2021 · 1 comment · Fixed by #77
Closed
3 tasks

Support authentication through payas-test module #61

ramnivas opened this issue Jun 17, 2021 · 1 comment · Fixed by #77

Comments

@ramnivas
Copy link
Contributor

ramnivas commented Jun 17, 2021

  • Introduce a mechanism to specify the requesting user. Perhaps something like:
operation: |
    query($id:Int!) {
        venue(id:$id) {
            name
        }
    } 
variable: |
    {
        "id": 1
    }
user: |
    {
       "sub": 20
       "role": "ROLE_ADMIN"
    }
  • Use a random string as the PAYAS_JWT_SECRET env variable and use that to both start the server and compute the JWT token after adding additional data needed to the "user" specified. For example,

JWT header:

{
  "alg": "HS256",
  "typ": "JWT"
}

Payload:

{
  "sub":<user.sub>,
  "iat": <now in seconds since epoch>,
  "exp": <now+one hour in seconds since epoch>,
  "role": <user.role>
}
  • Make requests with the header Authorization: Bearer <the computed JWT token>
@fx-chun
Copy link
Contributor

fx-chun commented Jun 18, 2021

Proposed format looks OK to me, will try to implement as-is

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

Successfully merging a pull request may close this issue.

2 participants