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

chore: remove dex #1097

Merged
merged 15 commits into from
Jul 8, 2024
Merged

chore: remove dex #1097

merged 15 commits into from
Jul 8, 2024

Conversation

cre8ivejp
Copy link
Member

@cre8ivejp cre8ivejp commented Jul 4, 2024

Part of #405

Things done

  • Removed dex
  • Refactor Auth API to reuse the refresh and token generation when using multiple Oauth services
  • Removed unused fields in the Authentication

This pull request includes several changes to the codebase, primarily focusing on the removal of certain OAuth configurations and dependencies from the backend and batch services, as well as the removal of the dex service. These changes are part of a larger effort to simplify the codebase and remove unnecessary dependencies.

Removal of OAuth configurations:

Removal of dependencies:

  • go.mod: Removed several dependencies from the Go module file. [1] [2] [3]

Removal of the dex service:

  • manifests/bucketeer/charts/dex/.helmignore, manifests/bucketeer/charts/dex/Chart.yaml, manifests/bucketeer/charts/dex/templates/NOTES.txt, manifests/bucketeer/charts/dex/templates/_helpers.tpl, manifests/bucketeer/charts/dex/templates/cert-secret.yaml, manifests/bucketeer/charts/dex/templates/configmap.yaml, manifests/bucketeer/charts/dex/templates/deployment.yaml: Removed all files related to the dex service. [1] [2] [3] [4] [5] [6]

Other changes:

  • Makefile, hack/generate-service-token/README.md, hack/generate-service-token/command.go: Removed the sub parameter from the generate-service-token command and related documentation. [1] [2] [3] [4] [5]

Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Comment on lines +29 to +36
) (*UserInfo, error)
}

type UserInfo struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Avatar string `json:"avatar"`
Email string `json:"email"`
Copy link
Member Author

@cre8ivejp cre8ivejp Jul 5, 2024

Choose a reason for hiding this comment

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

Since we will support other Oauth services, I'm moving the generateToken implementation to the API layer so the code can be reused.

Copy link
Member Author

Choose a reason for hiding this comment

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

The FirstName, LastName, and Avatar will be used in the new console. These values will be saved in the account_v2 table soon.

Comment on lines +47 to +48
Issuer string `json:"issuer"`
Audience string `json:"audience"`
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding these two fields. Before, we used the values from dex. From now, we will set them in the values.yaml

Comment on lines +294 to +295
oAuthConfig.Issuer,
oAuthConfig.Audience,
Copy link
Member Author

Choose a reason for hiding this comment

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

We use the values form the config file.

Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
)
dt, err := statusInternal.WithDetails(&errdetails.LocalizedMessage{
s.logger.Error("Refresh token is invalid", zap.Any("refresh_token", refreshToken))
dt, err := auth.StatusUnauthenticated.WithDetails(&errdetails.LocalizedMessage{
Copy link
Member Author

@cre8ivejp cre8ivejp Jul 5, 2024

Choose a reason for hiding this comment

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

Because the refresh token is generated by Bucketeer, we don't need to validate the redirectURL and authType.

If it fails when verifying, it will return an Unauthenticated error.

Comment on lines -78 to -79
string redirect_url = 2;
AuthType type = 3;
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need to validate these two fields because the refresh token is generated on the Bucketeer server.

Comment on lines -93 to -96
rpc ExchangeBucketeerToken(ExchangeBucketeerTokenRequest)
returns (ExchangeBucketeerTokenResponse);
rpc RefreshBucketeerToken(RefreshBucketeerTokenRequest)
returns (RefreshBucketeerTokenResponse);
Copy link
Member Author

Choose a reason for hiding this comment

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

I have renamed to use the old API name. Also, I have removed the old code.

Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm removing this since we use the secret for the OAuth key.

Comment on lines -25 to -30
string id_token = 5;
}

message IDTokenSubject {
string user_id = 1;
string conn_id = 2;
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed unused messages.

Comment on lines +86 to +87
issuer string,
audience string,
Copy link
Collaborator

@Ubisoft-potato Ubisoft-potato Jul 8, 2024

Choose a reason for hiding this comment

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

These two params didn't be used inside the NewAuthService function.

return &authService{
		issuer:        issuer,
		audience:      audience,
		signer:        signer,
		accountClient: accountClient,
		verifier:      verifier,
		googleAuthenticator: google.NewAuthenticator(
			&config.GoogleConfig, signer, logger,
		),
		opts:   &options,
		logger: logger,
	}

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

Signed-off-by: Alessandro Yuichi Okimoto <[email protected]>
Copy link
Collaborator

@Ubisoft-potato Ubisoft-potato left a comment

Choose a reason for hiding this comment

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

Great work! 🚀
LGTM!

@cre8ivejp cre8ivejp marked this pull request as ready for review July 8, 2024 04:42
@cre8ivejp cre8ivejp merged commit 1e49850 into main Jul 8, 2024
16 checks passed
@cre8ivejp cre8ivejp deleted the chore-remove-dex branch July 8, 2024 04:42
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.

None yet

2 participants