Bootstrap copied BFF and local accounts with public Sendico contracts (#34)

This commit is contained in:
Stephan D committed 2026-09-12 13:37:48 +02:00
1 parent 67dc5b5b1e
commit 7062672a87
556 files changed
+42291 -777

No files matched your search

@@ -0,0 +1,52 @@
package middleware
import "testing"
func TestTokenConfigValidate(t *testing.T) {
tests := []struct {
name string
config TokenConfig
wantErr bool
}{
{
name: "secure explicit TTLs",
config: TokenConfig{
Expiration: TokenExpiration{Account: 1, Refresh: 720},
Length: 32,
},
},
{
name: "rejects legacy 24 hour access token",
config: TokenConfig{
Expiration: TokenExpiration{Account: 24, Refresh: 720},
Length: 32,
},
wantErr: true,
},
{
name: "rejects missing access TTL",
config: TokenConfig{
Expiration: TokenExpiration{Refresh: 720},
Length: 32,
},
wantErr: true,
},
{
name: "rejects weak refresh token",
config: TokenConfig{
Expiration: TokenExpiration{Account: 1, Refresh: 720},
Length: 16,
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.config.Validate()
if (err != nil) != tt.wantErr {
t.Fatalf("Validate() error = %v, wantErr %t", err, tt.wantErr)
}
})
}
}