fix examples

This commit is contained in:
Livio Amstutz 2022-04-22 15:02:24 +02:00
parent 3dd0d5fc3a
commit 5c5d716409
No known key found for this signature in database
GPG key ID: 7AB5FDFBCA448635
6 changed files with 533 additions and 14 deletions

View file

@ -6,6 +6,7 @@ import (
"crypto/rsa"
"fmt"
"math/big"
"strings"
"time"
"github.com/google/uuid"
@ -80,7 +81,8 @@ func (s *publicKey) Key() interface{} {
return &s.key.PublicKey
}
func NewStorage() *storage {
func NewStorage(issuer string) *storage {
hostname := strings.Split(strings.Split(issuer, "://")[0], ":")[0]
key, _ := rsa.GenerateKey(rand.Reader, 2048)
return &storage{
authRequests: make(map[string]*AuthRequest),
@ -91,7 +93,7 @@ func NewStorage() *storage {
users: map[string]*User{
"id1": {
id: "id1",
username: "test-user",
username: "test-user@" + hostname,
password: "verysecure",
firstname: "Test",
lastname: "User",