diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-14 15:53:32 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-14 15:53:32 -0600 |
| commit | b12eb55fdb603290e3bc62880f6e9dff538571de (patch) | |
| tree | a9cfde922e251391f0618f9837d7b63a94156664 /app/controllers/sessions/controller.go | |
| parent | bb577738ac0359f8c8da0902b5c18af789ddf29d (diff) | |
feat: connect the sessions controller to oidc provider
Diffstat (limited to 'app/controllers/sessions/controller.go')
| -rw-r--r-- | app/controllers/sessions/controller.go | 13 |
1 files changed, 5 insertions, 8 deletions
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) } |
