Added basic auth and route protection

This commit is contained in:
2024-04-26 15:13:13 +01:00
parent aba3c335c4
commit ff4a77b4b4
8 changed files with 154 additions and 11 deletions

33
auth.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"context"
)
// App struct
type Auth struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewAuth() *Auth {
return &Auth{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *Auth) startup(ctx context.Context) {
a.ctx = ctx
}
func (a *Auth) Login() error {
return nil
}
func (a *Auth) Register() error {
return nil
}
func (a *Auth) IsLoggedIn() bool {
return false
}