forked from oauth2-proxy/oauth2-proxy
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
514 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ func getAccessToken() string { | |
} | ||
|
||
func newTestKeycloakOIDCSetup() (*httptest.Server, *KeycloakOIDCProvider) { | ||
redeemURL, server := newOIDCServer([]byte(fmt.Sprintf(`{"email": "[email protected]", "expires_in": 300, "access_token": "%v"}`, getAccessToken()))) | ||
redeemURL, server := newOIDCServer([]byte(fmt.Sprintf(`{"email": "[email protected]", "expires_in": 300, "access_token": "%v"}`, getAccessToken())), []byte(fmt.Sprintf(`{"email": "[email protected]", "expires_in": 300, "access_token": "%v"}`, getAccessToken())), []byte(fmt.Sprintf(`{"email": "[email protected]", "expires_in": 300, "access_token": "%v"}`, getAccessToken()))) | ||
provider := newKeycloakOIDCProvider(redeemURL, options.KeycloakOptions{}) | ||
return server, provider | ||
} | ||
|
@@ -49,23 +49,31 @@ func newKeycloakOIDCProvider(serverURL *url.URL, opts options.KeycloakOptions) * | |
AudienceClaims: []string{defaultAudienceClaim}, | ||
ClientID: mockClientID, | ||
} | ||
var hostURL string | ||
if serverURL == nil { | ||
hostURL = "keycloak-oidc.com" | ||
|
||
} else { | ||
hostURL = serverURL.Host | ||
} | ||
|
||
p := NewKeycloakOIDCProvider( | ||
&ProviderData{ | ||
LoginURL: &url.URL{ | ||
Scheme: "https", | ||
Host: "keycloak-oidc.com", | ||
Host: hostURL, | ||
Path: "/oauth/auth"}, | ||
RedeemURL: &url.URL{ | ||
Scheme: "https", | ||
Host: "keycloak-oidc.com", | ||
Path: "/oauth/token"}, | ||
Host: hostURL, | ||
Path: "/login/oauth/access_token"}, | ||
ProfileURL: &url.URL{ | ||
Scheme: "https", | ||
Host: "keycloak-oidc.com", | ||
Host: hostURL, | ||
Path: "/api/v3/user"}, | ||
ValidateURL: &url.URL{ | ||
Scheme: "https", | ||
Host: "keycloak-oidc.com", | ||
Host: hostURL, | ||
Path: "/api/v3/user"}, | ||
Scope: "openid email profile"}, | ||
opts) | ||
|
@@ -75,6 +83,8 @@ func newKeycloakOIDCProvider(serverURL *url.URL, opts options.KeycloakOptions) * | |
p.RedeemURL.Host = serverURL.Host | ||
} | ||
|
||
fmt.Println("RedeemURL was: " + p.RedeemURL.String()) | ||
|
||
keyset := DummyKeySet{} | ||
p.Verifier = internaloidc.NewVerifier(oidc.NewVerifier("", keyset, &oidc.Config{ | ||
ClientID: "client", | ||
|
@@ -94,7 +104,7 @@ var _ = Describe("Keycloak OIDC Provider Tests", func() { | |
providerData := p.Data() | ||
Expect(providerData.ProviderName).To(Equal(keycloakOIDCProviderName)) | ||
Expect(providerData.LoginURL.String()).To(Equal("https://keycloak-oidc.com/oauth/auth")) | ||
Expect(providerData.RedeemURL.String()).To(Equal("https://keycloak-oidc.com/oauth/token")) | ||
Expect(providerData.RedeemURL.String()).To(Equal("https://keycloak-oidc.com/login/oauth/access_token")) | ||
Expect(providerData.ProfileURL.String()).To(Equal("https://keycloak-oidc.com/api/v3/user")) | ||
Expect(providerData.ValidateURL.String()).To(Equal("https://keycloak-oidc.com/api/v3/user")) | ||
Expect(providerData.Scope).To(Equal("openid email profile")) | ||
|
@@ -186,6 +196,8 @@ var _ = Describe("Keycloak OIDC Provider Tests", func() { | |
User: "already", | ||
Email: "[email protected]", | ||
Groups: nil, | ||
CreatedAt: nil, | ||
ExpiresOn: nil, | ||
IDToken: idToken, | ||
AccessToken: getAccessToken(), | ||
RefreshToken: refreshToken, | ||
|
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
Oops, something went wrong.