summaryrefslogtreecommitdiff
path: root/app/controllers/sessions
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-14 14:29:52 -0600
committermo khan <mo@mokhan.ca>2025-04-14 14:29:52 -0600
commitebc754b0efead25ca0e899164ae8196c2b76789b (patch)
treecf6b6204725c9af601a8c5b1f6064ea8434b2829 /app/controllers/sessions
parenteb04ea074b64c9e36d0d81e0a0a23832362e97fb (diff)
test: add target audience for oidc transaction
Diffstat (limited to 'app/controllers/sessions')
-rw-r--r--app/controllers/sessions/controller_test.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/app/controllers/sessions/controller_test.go b/app/controllers/sessions/controller_test.go
index eeafd60..51536a4 100644
--- a/app/controllers/sessions/controller_test.go
+++ b/app/controllers/sessions/controller_test.go
@@ -12,17 +12,21 @@ import (
)
func TestSessions(t *testing.T) {
+ audience := "https://sparklelab.example.com"
cfg := &oauth2.Config{
- ClientID: "client_id",
- RedirectURL: "https://sparklelab.example.com/callback",
- Scopes: []string{"openid"},
+ ClientID: "client_id",
+ ClientSecret: "client_secret",
+ RedirectURL: audience + "/callback",
+ Scopes: []string{"openid"},
Endpoint: oauth2.Endpoint{
- AuthURL: "https://gitlab.com/oauth/authorize",
- TokenURL: "https://gitlab.com/oauth/token",
+ AuthStyle: oauth2.AuthStyleAutoDetect,
+ AuthURL: "https://gitlab.com/oauth/authorize",
+ DeviceAuthURL: "https://gitlab.com/oauth/authorize",
+ TokenURL: "https://gitlab.com/oauth/token",
},
}
- controller := New(cfg)
+ controller := New(cfg, audience)
mux := http.NewServeMux()
controller.MountTo(mux)
@@ -43,7 +47,8 @@ func TestSessions(t *testing.T) {
assert.NotEmpty(t, redirectURL.Query().Get("state"))
assert.Equal(t, "client_id", redirectURL.Query().Get("client_id"))
assert.Equal(t, "openid", redirectURL.Query().Get("scope"))
- assert.Equal(t, "https://sparklelab.example.com/callback", redirectURL.Query().Get("redirect_uri"))
+ assert.Equal(t, audience, redirectURL.Query().Get("audience"))
+ assert.Equal(t, cfg.RedirectURL, redirectURL.Query().Get("redirect_uri"))
assert.Equal(t, "code", redirectURL.Query().Get("response_type"))
})
})