This can verify a JWT using the JWKS fetched from an OAuth's endpoint.

This commit is contained in:
Annika Merris 2024-02-09 19:30:50 -05:00
parent d4b2d5fefb
commit ac18b94a86
6 changed files with 173 additions and 10 deletions

View file

@ -1,6 +1,28 @@
package main
import (
"log/slog"
"strings"
)
type EnvConfigs struct {
HttpPort string `mapstructure:"HTTP_PORT"`
ConnectionString string `mapstructure:"DB_CONNECTION_STRING"`
JWKSURI string `mapstructure:"JWKS_URI"`
LogLevel string `mapstructure:"LOG_LEVEL"`
}
func (ec *EnvConfigs) GetLogLevel() slog.Level {
switch strings.ToLower(ec.LogLevel) {
case "debug":
return slog.LevelDebug
case "info":
return slog.LevelInfo
case "warn":
return slog.LevelWarn
case "error":
return slog.LevelError
default:
return slog.LevelInfo
}
}