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

feat(api-keys): add read_only field to api-keys #3554

Merged
merged 8 commits into from
Nov 17, 2023
Merged

Conversation

bodymindarts
Copy link
Member

No description provided.

@github-actions github-actions bot added the core label Nov 15, 2023
@bodymindarts bodymindarts requested review from nicolasburtey and vindard and removed request for nicolasburtey November 15, 2023 20:10
@bodymindarts bodymindarts changed the title feat: add read_only field to api-keys feat(api-keys): add read_only field to api-keys Nov 15, 2023
return resolve(parent, args, context, info)
}

return mapError(new AuthorizationError("not authorized to read transactions"))
return mapError(new AuthorizationError("not authorized to read data"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuing if we have a read_only, the alternative is a read+write token, so I don't think there is a scenario currently in which we are not authorized to read?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically when logging into dashboard someone may just select 'Offline' scope - though that is unlikely as we are skipping that step in production.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the offline for now btw, we don't need a refresh token for our current use case. I was using it when developing on hydra to get a deeper understanding of hydra and oauth2

}

if (scope.find((s) => s === ScopesOauth2.PaymentsSend) !== undefined) {
if (scope.find((s) => s === ScopesOauth2.Write) !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we get an otel span propagate with the scope of the request?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -87,7 +87,7 @@
mutators:
- handler: id_token
config: #! TODO: add aud: {"aud": ["https://api/graphql"] }
claims: '{"sub": "{{ print .Subject }}", "session_id": "{{ print .Extra.id }}", "expires_at": "{{ print .Extra.expires_at }}", "scope": "{{ print .Extra.scope }}", "client_id": "{{ print .Extra.client_id }}" }'
claims: '{"sub": "{{ print .Subject }}", "session_id": "{{ print .Extra.id }}", "expires_at": "{{ print .Extra.expires_at }}", "scope": "{{ print .Extra.scope }}", "client_id": "{{ print .Extra.client_id }}"}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to know if a request comes from an API token versus kratos or hydra?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we currently have a clear differentiation ATM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should definitively have that (as a follow up PR)

vindard
vindard previously approved these changes Nov 16, 2023
Co-authored-by: Siddharth <siddharth@debian.siddharth>
@bodymindarts bodymindarts merged commit 47ace19 into main Nov 17, 2023
17 checks passed
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 this pull request may close these issues.

4 participants