-
Notifications
You must be signed in to change notification settings - Fork 134
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
Change DB schema and backend to support storing a client/secret for each Endpoint #2269
Change DB schema and backend to support storing a client/secret for each Endpoint #2269
Conversation
Hey andrewghobrial! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good.
Minor changes - see comments.
Would also suggest that the Client Secret database column is encrypted, as we do with the Access and Refresh tokens.
Once we get this in, I am happy to apply these changes to V2 code base.
components/app-core/backend/cnsi.go
Outdated
@@ -46,7 +46,15 @@ func (p *portalProxy) RegisterEndpoint(c echo.Context, fetchInfo interfaces.Info | |||
skipSSLValidation = false | |||
} | |||
|
|||
newCNSI, err := p.DoRegisterEndpoint(cnsiName, apiEndpoint, skipSSLValidation, fetchInfo) | |||
cfclientid := c.FormValue("cf_client_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make these vars and the form values generically named - ie. loose the cf prefix. We will support other endpoint types over time.
databaseProvider := os.Getenv("DATABASE_PROVIDER") | ||
fmt.Printf("ENV is: %s", databaseProvider) | ||
|
||
alterCnsis := "ALTER TABLE cnsis ADD COLUMN client_id boolean NOT NULL DEFAULT 'cf';" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Column type boolean - should be string?
fmt.Printf("Failed to migrate due to: %v", err) | ||
} | ||
|
||
alterCnsis = "ALTER TABLE cnsis ADD COLUMN client_secret boolean NOT NULL DEFAULT '';" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Column type boolean - seems wrong.
@nwmac ok thanks for the review. i'm looking into encrypting the client secret. |
@nwmac ok made it so that it encrypts the client secret and fixed the other things |
…ratos into multiple-clients
@andrewghobrial Do you still want this in V1, or given we have this in V2, can we close? |
1 similar comment
@andrewghobrial Do you still want this in V1, or given we have this in V2, can we close? |
@nwmac We've fully switched to v2 so you can close this. |
Fixed in V2 |
This a pull request to support storing a client_id and client_secret in the cnsis DB table. This is needed to support SSO when different endpoints have unique client/secret credentials.
Description
This PR does not make any functional changes. It allows to a different client/secret to be stored for each endpoint in the cnsis DB. Whenever logging into an endpoint, its unique client/secret is pulled from its database entry. The default client/secret is still "cf", "". So there are no breaking changes.
Motivation and Context
Required to support SSO for multiple endpoints.
How Has This Been Tested?
Types of changes
Checklist: