Feat: add preshared key check

This commit is contained in:
2025-12-07 19:14:06 +08:00
parent f4c92504e8
commit cada4d25fa
3 changed files with 49 additions and 1 deletions

View File

@@ -106,7 +106,8 @@ var serveCmd = &cobra.Command{
authGroup := backend.NewGroup("/auth")
authGroup.POST("/login", auths.PostLogin)
authGroup.POST("/gen-login-url", auths.PostGenLoginUrl)
authGroup.POST("/gen-login-url",
midHandlers.CheckPresharedKey(auths.PostGenLoginUrl))
if viper.GetBool("swagger") {
backend.GET("/swagger/*any",
@@ -127,6 +128,8 @@ func init() {
String("external-url", "http://localhost:8080", "External url for login")
serveCmd.Flags().
String("cors-origin", "", "CORS origin")
serveCmd.Flags().
String("preshared-key", "poop", "Preshared key for Discord Bot")
serveCmd.Flags().
Int64("access-token-timeout", 300, "Timeout of Access Token JWT")