added oauth flow to get authorization code
This commit is contained in:
@@ -53,7 +53,7 @@ func setupHttpServer(
|
||||
return nil, errors.Wrap(err, "httpServer.LoggerIgnorePaths")
|
||||
}
|
||||
|
||||
err = addRoutes(httpServer, &fs, config, logger, bun, auth)
|
||||
err = addRoutes(httpServer, &fs, config, bun, auth)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "addRoutes")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"git.haelnorr.com/h/oslstats/internal/db"
|
||||
"git.haelnorr.com/h/oslstats/internal/handlers"
|
||||
|
||||
"git.haelnorr.com/h/golib/hlog"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
@@ -17,8 +16,7 @@ import (
|
||||
func addRoutes(
|
||||
server *hws.Server,
|
||||
staticFS *http.FileSystem,
|
||||
config *config.Config,
|
||||
logger *hlog.Logger,
|
||||
cfg *config.Config,
|
||||
conn *bun.DB,
|
||||
auth *hwsauth.Authenticator[*db.User, bun.Tx],
|
||||
) error {
|
||||
@@ -34,6 +32,16 @@ func addRoutes(
|
||||
Method: hws.MethodGET,
|
||||
Handler: handlers.Index(server),
|
||||
},
|
||||
{
|
||||
Path: "/login",
|
||||
Method: hws.MethodGET,
|
||||
Handler: auth.LogoutReq(handlers.Login(server, cfg)),
|
||||
},
|
||||
{
|
||||
Path: "/auth/callback",
|
||||
Method: hws.MethodGET,
|
||||
Handler: auth.LogoutReq(handlers.Callback(server, cfg)),
|
||||
},
|
||||
}
|
||||
|
||||
// Register the routes with the server
|
||||
|
||||
Reference in New Issue
Block a user