mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-09-25 09:24:32 +00:00
Add github-specific tests in callback_handler_github_test.go
Co-authored-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
co-authored by
Ryan Richard
parent
2756a106a9
commit
b7f79f0adc
+21
-6
@@ -91,13 +91,28 @@ func (p *FederationDomainResolvedGitHubIdentityProvider) Login(
|
||||
}
|
||||
|
||||
func (p *FederationDomainResolvedGitHubIdentityProvider) LoginFromCallback(
|
||||
_ context.Context,
|
||||
_ string,
|
||||
_ pkce.Code,
|
||||
_ nonce.Nonce,
|
||||
_ string,
|
||||
ctx context.Context,
|
||||
authCode string,
|
||||
_ pkce.Code, // GitHub does not support PKCE, see https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps
|
||||
_ nonce.Nonce, // GitHub does not support OIDC, therefore there is no ID token that could contain the "nonce".
|
||||
redirectURI string,
|
||||
) (*resolvedprovider.Identity, *resolvedprovider.IdentityLoginExtras, error) {
|
||||
return nil, nil, errors.New("function LoginFromCallback not yet implemented for GitHub IDP")
|
||||
token, _ := p.Provider.ExchangeAuthcode(
|
||||
ctx,
|
||||
authCode,
|
||||
redirectURI,
|
||||
)
|
||||
|
||||
return &resolvedprovider.Identity{
|
||||
UpstreamUsername: "some-github-login",
|
||||
UpstreamGroups: []string{"org1/team1", "org2/team2"},
|
||||
DownstreamSubject: "https://github.com?idpName=upstream-github-idp-name&sub=some-github-login",
|
||||
IDPSpecificSessionData: &psession.GitHubSessionData{
|
||||
UpstreamAccessToken: token,
|
||||
},
|
||||
},
|
||||
&resolvedprovider.IdentityLoginExtras{},
|
||||
nil
|
||||
}
|
||||
|
||||
func (p *FederationDomainResolvedGitHubIdentityProvider) UpstreamRefresh(
|
||||
|
||||
Reference in New Issue
Block a user