Skip to content

Commit

Permalink
Add back auth.PrivateKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Toogood committed Apr 1, 2020
1 parent 365dfe9 commit d577c32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions auth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type Options struct {
Token *Token
// PublicKey for decoding JWTs
PublicKey string
// PrivateKey for encoding JWTs
PrivateKey string
// Provider is an auth provider
Provider provider.Provider
// LoginURL is the relative url path where a user can login
Expand All @@ -40,6 +42,13 @@ func PublicKey(key string) Option {
}
}

// PrivateKey is the JWT private key
func PrivateKey(key string) Option {
return func(o *Options) {
o.PrivateKey = key
}
}

// Credentials sets the auth credentials
func Credentials(id, secret string) Option {
return func(o *Options) {
Expand Down
3 changes: 3 additions & 0 deletions config/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ func (c *cmd) Before(ctx *cli.Context) error {
if len(ctx.String("auth_public_key")) > 0 {
authOpts = append(authOpts, auth.PublicKey(ctx.String("auth_public_key")))
}
if len(ctx.String("auth_private_key")) > 0 {
authOpts = append(authOpts, auth.PrivateKey(ctx.String("auth_private_key")))
}

if name := ctx.String("auth_provider"); len(name) > 0 {
p, ok := DefaultAuthProviders[name]
Expand Down

0 comments on commit d577c32

Please sign in to comment.