Merge pull request #1802 from concourse/pr/static-public-key-sync

Add constructor for static key strategy
This commit is contained in:
Márk Sági-Kazár 2020-10-01 22:19:15 +02:00 committed by GitHub
commit d4c3a3505d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package server
import (
"context"
"crypto/rsa"
"encoding/json"
"errors"
"fmt"
@ -172,6 +173,13 @@ func NewServer(ctx context.Context, c Config) (*Server, error) {
))
}
// NewServerWithKey constructs a server from the provided config and a static signing key.
func NewServerWithKey(ctx context.Context, c Config, privateKey *rsa.PrivateKey) (*Server, error) {
return newServer(ctx, c, staticRotationStrategy(
privateKey,
))
}
func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy) (*Server, error) {
issuerURL, err := url.Parse(c.Issuer)
if err != nil {