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

Authenticate API requests #53

Merged
merged 5 commits into from
Mar 24, 2023

Conversation

jnschaeffer
Copy link
Contributor

@jnschaeffer jnschaeffer commented Mar 24, 2023

The current implementation of authentication in permissions-api expects a URN in the bearer token instead of a JWT. This PR updates permissions-api's API server to use JWT validation from ginjwt and URN parsing from urnx for more robust and secure authentication of clients making API requests.

Additionally, to make local development easier, a mock-oauth2-server service has been added to the Compose file. This service can be used to get JWT access tokens that permissions-api can be configured to accept instead of using an external identity provider or other authorization server.

In general, it is expected that services require authentication even
when called directly instead of through a gateway. This commit
replaces the prior authentication strategy of setting the subject URN
as the bearer token value with JWT bearer token authentication. To
make local development easier, this commit also adds a
mock-oauth2-server service to the dev container environment and an
example config that uses it for JWT validation.

Signed-off-by: John Schaeffer <[email protected]>
The urnx package provides a convenient way for us to parse
Infratographer URNs across services. This commit updates
permissions-api to use it for subject and resource URNs instead of
string manipulation logic.

Signed-off-by: John Schaeffer <[email protected]>
This check isn't being used anywhere and breaks in CI. This commit
removes it.

Signed-off-by: John Schaeffer <[email protected]>
fishnix
fishnix previously approved these changes Mar 24, 2023
Copy link
Contributor

@fishnix fishnix left a comment

Choose a reason for hiding this comment

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

just the one minor thing, otherwise looks good to me

pkg/pubsubx/worker.go Outdated Show resolved Hide resolved
@jnschaeffer jnschaeffer merged commit 55270df into infratographer:main Mar 24, 2023
@jnschaeffer jnschaeffer deleted the authenticate-api branch March 24, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants