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

fix: access path for auth endpoints #1403

Merged
merged 6 commits into from
Dec 7, 2023
Merged

Conversation

veds-g
Copy link
Contributor

@veds-g veds-g commented Dec 4, 2023

  • added access path for auth/v1 api endpoints

@veds-g veds-g requested review from whynowy and vigith as code owners December 4, 2023 10:55
server/authz/route_map.go Outdated Show resolved Hide resolved
server/authz/route_map.go Outdated Show resolved Hide resolved
server/authz/route_map.go Outdated Show resolved Hide resolved
server/authz/route_map.go Outdated Show resolved Hide resolved
server/authz/route_map.go Outdated Show resolved Hide resolved
Signed-off-by: veds-g <[email protected]>
Signed-off-by: veds-g <[email protected]>
// It is called only once when the server starts.
// It adds baseHref to the routeMap keys.
// For example, "GET:/api/v1/namespaces" becomes "GET:/baseHref/api/v1/namespaces".
func InitializeRouteMapInfo(baseHref string) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's see if there's a better pattern in the future.

"GET:/api/v1/metrics/namespaces/:namespace/pods": newRouteInfo(ObjectPipeline, true),
"GET:/api/v1/namespaces/:namespace/pods/:pod/logs": newRouteInfo(ObjectPipeline, true),
"GET:/api/v1/namespaces/:namespace/events": newRouteInfo(ObjectEvents, true),
var AuthRouteMap routeMap
Copy link
Member

Choose a reason for hiding this comment

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

global vars that are mutable could lead to race/concurrency issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, today we only update it once in the beginning, later we only perform read operations. Do you think this works as is now or should we refactor it?

Copy link
Member

Choose a reason for hiding this comment

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

@veds-g - let's make routeMap an argument to the Routes() function, and pass to the casbin object.

Signed-off-by: veds-g <[email protected]>
@whynowy whynowy merged commit 263263b into numaproj:main Dec 7, 2023
18 checks passed
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