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

Backend auth #65

Merged
merged 31 commits into from
Oct 31, 2022
Merged

Backend auth #65

merged 31 commits into from
Oct 31, 2022

Conversation

maia-iyer
Copy link
Collaborator

@maia-iyer maia-iyer commented Sep 19, 2022

For early review. Backend implementation for #63 Currently in progress:

  • toggle for auth flow
  • passes config by config file

Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
run_server.sh Outdated Show resolved Hide resolved
run_server.sh Outdated Show resolved Hide resolved
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Copy link
Collaborator

@lumjjb lumjjb left a comment

Choose a reason for hiding this comment

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

Looks good in general, left a couple comments, and needs some testing!

run_server.sh Outdated Show resolved Hide resolved
tornjak-backend/api/agent/server.go Outdated Show resolved Hide resolved
tornjak-backend/api/agent/server.go Show resolved Hide resolved
rtr.HandleFunc("/api/agent/list", s.agentList)
rtr.HandleFunc("/api/agent/ban", s.agentBan)
rtr.HandleFunc("/api/agent/delete", s.agentDelete)
rtr.HandleFunc("/api/agent/createjointoken", s.agentCreateJoinToken)
Copy link
Collaborator

Choose a reason for hiding this comment

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

im assuming now that its serving from the same domain / server that CORS policy isnt required and that's why its removed yea? or was in put in a different way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes so I added middleware for the authorization function, and I put the CORS handler there

tornjak-backend/api/agent/server.go Outdated Show resolved Hide resolved
api_permissions["/api/tornjak/selectors/register"] = []string{"admin"}
api_permissions["/api/tornjak/clusters/create"] = []string{"admin"}
api_permissions["/api/tornjak/clusters/edit"] = []string{"admin"}
api_permissions["/api/tornjak/clusters/delete"] = []string{"admin"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have this be part of a map defined instead so it's easier to view, and also we don't have to initialize it each time

Copy link
Collaborator

Choose a reason for hiding this comment

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

@lumjjb we will be externalizing it into a config file as a separate effort, lead by our intern. Let's leave this as is for now.

tornjak-backend/pkg/agent/auth/keycloak.go Outdated Show resolved Hide resolved
tornjak-backend/pkg/agent/auth/keycloak.go Outdated Show resolved Hide resolved
tornjak-backend/pkg/agent/auth/keycloak.go Show resolved Hide resolved
tornjak-backend/api/agent/server.go Outdated Show resolved Hide resolved
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
maia-iyer and others added 3 commits October 6, 2022 14:05
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
Copy link
Collaborator

@mrsabath mrsabath left a comment

Choose a reason for hiding this comment

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

LGTM

@maia-iyer maia-iyer merged commit c4d7c3a into spiffe:main Oct 31, 2022
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