forked from mystiq/dex
Add constructor for static key strategy
Co-authored-by: Josh Winters <jwinter@pivotal.io> Signed-off-by: Rui Yang <ruiya@vmware.com>
This commit is contained in:
parent
9781e56ba5
commit
bd2234cd12
1 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,7 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/rsa"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"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) {
|
func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy) (*Server, error) {
|
||||||
issuerURL, err := url.Parse(c.Issuer)
|
issuerURL, err := url.Parse(c.Issuer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue