-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
scope
flag to idp commands (#19727)
* Add `scope` flag to idp commands * fix flag inherit
- Loading branch information
1 parent
2aaa732
commit 5ff4535
Showing
11 changed files
with
124 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,56 @@ func TestGetIDToken(t *testing.T) { | |
Error: connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("Must have at least one audience entry")).Error(), | ||
}, | ||
}, | ||
{ | ||
Name: "include scope", | ||
TokenSource: func(t *testing.T) IDTokenSource { | ||
return functionIDTokenSource(func(ctx context.Context, org string, audience []string, userInfo oidc.UserInfo) (string, error) { | ||
require.Equal(t, "[email protected]", userInfo.GetEmail()) | ||
require.True(t, userInfo.IsEmailVerified()) | ||
require.Equal(t, "foo", userInfo.GetClaim("scope")) | ||
|
||
return "foobar", nil | ||
}) | ||
}, | ||
ServerSetup: func(ma *protocol.MockAPIInterface) { | ||
ma.EXPECT().GetIDToken(gomock.Any()).MinTimes(1).Return(nil) | ||
ma.EXPECT().GetWorkspace(gomock.Any(), workspaceID).MinTimes(1).Return( | ||
&protocol.WorkspaceInfo{ | ||
Workspace: &protocol.Workspace{ | ||
ContextURL: "https://github.com/gitpod-io/gitpod", | ||
Context: &protocol.WorkspaceContext{ | ||
Repository: &protocol.Repository{ | ||
CloneURL: "https://github.com/gitpod-io/gitpod.git", | ||
}, | ||
}, | ||
}, | ||
}, | ||
nil, | ||
) | ||
ma.EXPECT().GetLoggedInUser(gomock.Any()).Return( | ||
&protocol.User{ | ||
Name: "foobar", | ||
Identities: []*protocol.Identity{ | ||
nil, | ||
{Deleted: true, PrimaryEmail: "[email protected]"}, | ||
{Deleted: false, PrimaryEmail: "[email protected]"}, | ||
}, | ||
OrganizationId: "test", | ||
}, | ||
nil, | ||
) | ||
}, | ||
Request: &v1.GetIDTokenRequest{ | ||
WorkspaceId: workspaceID, | ||
Audience: []string{"some.audience.com"}, | ||
Scope: "foo", | ||
}, | ||
Expectation: Expectation{ | ||
Response: &v1.GetIDTokenResponse{ | ||
Token: "foobar", | ||
}, | ||
}, | ||
}, | ||
{ | ||
Name: "token source error", | ||
TokenSource: func(t *testing.T) IDTokenSource { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 27 additions & 18 deletions
45
components/public-api/go/experimental/v1/identityprovider.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
components/public-api/typescript/src/gitpod/experimental/v1/identityprovider_pb.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.