From b12eb55fdb603290e3bc62880f6e9dff538571de Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 14 Apr 2025 15:53:32 -0600 Subject: feat: connect the sessions controller to oidc provider --- app/controllers/sessions/controller.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'app/controllers/sessions/controller.go') diff --git a/app/controllers/sessions/controller.go b/app/controllers/sessions/controller.go index c75e204..1a709de 100644 --- a/app/controllers/sessions/controller.go +++ b/app/controllers/sessions/controller.go @@ -3,19 +3,16 @@ package sessions import ( "net/http" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "golang.org/x/oauth2" ) type Controller struct { - audience string - cfg *oauth2.Config + cfg *oidc.OpenID } -func New(cfg *oauth2.Config, audience string) *Controller { - return &Controller{ - audience: audience, - cfg: cfg, - } +func New(cfg *oidc.OpenID) *Controller { + return &Controller{cfg: cfg} } func (c *Controller) MountTo(mux *http.ServeMux) { @@ -25,6 +22,6 @@ func (c *Controller) MountTo(mux *http.ServeMux) { func (c *Controller) New(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusFound) - url := c.cfg.AuthCodeURL("csrf-token", oauth2.SetAuthURLParam("audience", c.audience)) + url := c.cfg.Config.AuthCodeURL("todo-csrf-token", oauth2.SetAuthURLParam("audience", "todo")) http.Redirect(w, r, url, http.StatusFound) } -- cgit v1.2.3