fix examples and update usage

This commit is contained in:
Livio Amstutz 2022-04-22 15:42:09 +02:00
parent 636d0db033
commit 33a38e9c07
No known key found for this signature in database
GPG key ID: 7AB5FDFBCA448635
4 changed files with 16 additions and 5 deletions

View file

@ -40,7 +40,7 @@ func main() {
port := "9998"
issuers := make([]string, len(hostnames))
for i, hostname := range hostnames {
issuers[i] = fmt.Sprintf("http://%s:%s", hostname, port)
issuers[i] = fmt.Sprintf("http://%s:%s/", hostname, port)
}
//the OpenID Provider requires a 32-byte key for (token) encryption

View file

@ -82,7 +82,7 @@ func (s *publicKey) Key() interface{} {
}
func NewStorage(issuer string) *storage {
hostname := strings.Split(strings.Split(issuer, "://")[0], ":")[0]
hostname := strings.Split(strings.Split(issuer, "://")[1], ":")[0]
key, _ := rsa.GenerateKey(rand.Reader, 2048)
return &storage{
authRequests: make(map[string]*AuthRequest),

View file

@ -254,7 +254,7 @@ func (s *multiStorage) Health(ctx context.Context) error {
func (s *multiStorage) storageFromContext(ctx context.Context) (*storage, *oidc.Error) {
storage, ok := s.issuers[op.IssuerFromContext(ctx)]
if !ok {
return nil, oidc.ErrInvalidRequest().WithDescription("invalid issuer")
}
return storage, nil
}