Auth stuff

This commit is contained in:
2024-10-22 00:12:28 +08:00
parent 85783aa331
commit ed05782319
12 changed files with 236 additions and 18 deletions

View File

@@ -2,9 +2,11 @@ package main
import (
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/internal/auth"
"git.solsynth.dev/hypernet/nexus/pkg/internal/database"
"git.solsynth.dev/hypernet/nexus/pkg/internal/http"
"git.solsynth.dev/hypernet/nexus/pkg/internal/kv"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"github.com/fatih/color"
"os"
"os/signal"
@@ -70,6 +72,14 @@ func main() {
}
}
// Read the public key for jwt
if reader, err := sec.NewJwtReader(viper.GetString("security.public_key")); err != nil {
log.Error().Err(err).Msg("An error occurred when reading public key for jwt. Authentication related features will be disabled.")
} else {
auth.JReader = reader
log.Info().Msg("Jwt public key loaded.")
}
// Server
go server.NewServer().Listen()