Skip to content

feat: implement create demo organization - #2009

Merged
hvn2k1 merged 10 commits into
mainfrom
create-demo-org
Jul 22, 2025
Merged

feat: implement create demo organization#2009
hvn2k1 merged 10 commits into
mainfrom
create-demo-org

Conversation

@hvn2k1

@hvn2k1 hvn2k1 commented Jul 17, 2025

Copy link
Copy Markdown
Contributor

Part of #1796

Comment thread pkg/auth/google/authenticator.go Outdated
Picture string `json:"picture"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
EmailVerified bool `json:"verified_email"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment thread pkg/rpc/server.go Outdated
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
cre8ivejp and others added 4 commits July 21, 2025 19:12
Comment thread pkg/rpc/auth.go Outdated
Comment on lines +75 to +83
if (token == nil || token.OrganizationID == "") &&
strings.HasPrefix(info.FullMethod, createDemoOrganizationName) {
demoToken, err := verifier.VerifyDemoCreationToken(subs[1])
if err != nil {
return nil, status.Errorf(codes.Unauthenticated, "token is invalid: %s", err.Error())
}
ctx = context.WithValue(ctx, Key, demoToken)
return handler(ctx, req)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You skip the request here for the demo creation here, but you are verifying in the interceptor?

Since you are already verifying the token in the create API, we don't need this code in the interceptor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't skip the request for the demo creation, that slice only have 3 items. I also didn't verifying the token in the create API, I only get it in here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here, you verify the access token for the admin console, but if the request is for the demo creation, it will fail returning the Unauthenticated error, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It won't return error, but it won't contain these information: OrganizationID, IsSystemAdmin, Name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And since organizationID is empty and IsSystemAdmin is false, the token cannot be used to bypass in any other API

Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
@hvn2k1
hvn2k1 force-pushed the create-demo-org branch from 6f2b2a2 to a4fe412 Compare July 22, 2025 09:30

@cre8ivejp cre8ivejp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work 🎉

@hvn2k1
hvn2k1 merged commit fc19249 into main Jul 22, 2025
@hvn2k1
hvn2k1 deleted the create-demo-org branch July 22, 2025 11:34
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.

2 participants