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

Document RBAC client implementation #1363

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

epapbak
Copy link
Collaborator

@epapbak epapbak commented Oct 29, 2024

Description

Document for RBAC client implementation

Part of CCXDEV-12884

Type of change

  • Documentation update

Testing steps

N/A

Checklist

  • make before_commit passes
  • updated documentation wherever necessary
  • added or modified tests if necessary
  • updated schemas and validators in insights-data-schemas in case of input/output change

@epapbak epapbak marked this pull request as ready for review October 29, 2024 08:48

### Authentication Middleware

The authentication middleware is responsible for verifying that the request has been made by a known party, and that said party's identity token has all the information necessary for identification of the concrete requester. It is implemented in the `auth` module and the `Authentication` function within the `auth_middleware.go` file. If enabled, authentication always happens before the authorization process.
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe wen can use a link to this file instead of just mentioning it


### Authorization Middleware

The authorization middleware is responsible for enforcing role-based access control (RBAC) for incoming requests. It is implemented in the `auth` module and the `Authorization` function within the `auth_middleware.go` file. The authorization middleware is set up in the `setupAuthMiddleware` function, which configures the router to use the `Authorization` middleware for routes that require RBAC checks.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’ve just realized auth_middleware may be misleading as it could refer to authorization or authentication, but I guess it’s not a big deal

#### Key Features:
- **RBAC Enforcement**: The middleware checks if the user has the necessary permissions to access the requested resource. A configuration option, `enforce`, was added to the RBAC configuration in order to enforce or bypass RBAC.
- **Bypass for Specific URLs**: Certain URLs can be configured to bypass authorization checks, allowing public access.
- **User Agent Handling**: Requests from specific user agents (e.g. ACM) can bypass RBAC checks for now. This is a temporary solution that was agreed upon with them, as there is a lot more work related to service accounts configurations and RBAC roles definitions to do in order to ensure that this new functionality doesn't affect our internal API consumers.
Copy link
Collaborator

Choose a reason for hiding this comment

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

as we are keeping the user access as it is, is this AMS specific configuration still needed?


For the authorization middleware to take action when access is not authorized, the RBAC enforcement must be enabled. This is done by setting the `enforce` flag in the RBAC client configuration.
- If enforcement is not enabled, the middleware will not block access even if the user is not authorized.
- For now, anything decision taken by the authorization middleware is logged, with the hope to get more information on customers' readiness and make future development easier.
Copy link
Collaborator

Choose a reason for hiding this comment

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

anything -> any

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.

3 participants