mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-06 19:38:09 +02:00
options: support multiple signing keys
This commit is contained in:
parent
c048af7523
commit
41b51d04ef
12 changed files with 223 additions and 67 deletions
|
@ -1176,18 +1176,27 @@ func (o *Options) GetCookieSecret() ([]byte, error) {
|
|||
}
|
||||
|
||||
// GetSigningKey gets the signing key.
|
||||
func (o *Options) GetSigningKey() (string, error) {
|
||||
func (o *Options) GetSigningKey() ([]byte, error) {
|
||||
if o == nil {
|
||||
return "", nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
rawSigningKey := o.SigningKey
|
||||
if o.SigningKeyFile != "" {
|
||||
bs, err := os.ReadFile(o.SigningKeyFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
return string(bs), nil
|
||||
rawSigningKey = string(bs)
|
||||
}
|
||||
return o.SigningKey, nil
|
||||
|
||||
rawSigningKey = strings.TrimSpace(rawSigningKey)
|
||||
|
||||
if bs, err := base64.StdEncoding.DecodeString(rawSigningKey); err == nil {
|
||||
return bs, nil
|
||||
}
|
||||
|
||||
return []byte(rawSigningKey), nil
|
||||
}
|
||||
|
||||
// Checksum returns the checksum of the current options struct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue