Add support for logout URL.

This commit is contained in:
2024-07-25 00:21:39 +01:00
parent 4baf3fbefd
commit 3fe92d38e0
5 changed files with 68 additions and 3 deletions
+13
View File
@@ -13,6 +13,7 @@ const (
type Config struct {
ProviderURL string `json:"providerURL"`
CallbackURL string `json:"callbackURL"`
LogoutURL string `json:"logoutURL"`
ClientID string `json:"clientID"`
ClientSecret string `json:"clientSecret"`
Scopes []string `json:"scopes"`
@@ -55,12 +56,22 @@ func NewLogger(level string) Logger {
return &defaultLogger{level: level}
}
func (l *defaultLogger) Info(args ...interface{}) {
if l.level == "info" || l.level == "debug" {
fmt.Println(append([]interface{}{"INFO:"}, args...)...)
}
}
func (l *defaultLogger) Infof(format string, args ...interface{}) {
if l.level == "info" || l.level == "debug" {
fmt.Printf("INFO: "+format+"\n", args...)
}
}
func (l *defaultLogger) Error(args ...interface{}) {
fmt.Fprintln(os.Stderr, append([]interface{}{"ERROR:"}, args...)...)
}
func (l *defaultLogger) Errorf(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: "+format+"\n", args...)
}
@@ -71,7 +82,9 @@ type HTTPClient interface {
}
type Logger interface {
Info(args ...interface{})
Infof(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
}