From 447c9fb5e9294a946481108017f23226bebe68da Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Fri, 26 Apr 2024 15:56:25 -0600 Subject: [PATCH] Reverted token fetch in server --- internal/server/server.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/server/server.go b/internal/server/server.go index 1cb7558..65e0f80 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -212,19 +212,19 @@ func (s *Server) StartLogin(clients []oauth.Client, params ServerParams) error { http.Redirect(w, r, "/error", http.StatusInternalServerError) return } + } else { + // FIXME: I think this probably needs to reworked or removed + // NOTE: this logic fetches a token for services to retrieve like BSS + // perform a client credentials grant and return a token + var err error + accessToken, err = flows.NewClientCredentialsFlow(params.ClientCredentialsEndpoints, params.ClientCredentialsParams) + if err != nil { + fmt.Printf("failed to perform client credentials flow: %v\n", err) + http.Redirect(w, r, "/error", http.StatusInternalServerError) + return + } + w.Write([]byte(accessToken)) } - // FIXME: I think this probably needs to reworked or removed - // else { - // // perform a client credentials grant and return a token - // var err error - // accessToken, err = flows.NewClientCredentialsFlow(params.ClientCredentialsEndpoints, params.ClientCredentialsParams) - // if err != nil { - // fmt.Printf("failed to perform client credentials flow: %v\n", err) - // http.Redirect(w, r, "/error", http.StatusInternalServerError) - // return - // } - // w.Write([]byte(accessToken)) - // } }) r.HandleFunc(callback, func(w http.ResponseWriter, r *http.Request) { // get the code from the OIDC provider