Move type to the first position of the struct.

pull/51/head
Mariano Cano 5 years ago
parent 23e6de57a2
commit 0b4cde1ad3

@ -18,9 +18,9 @@ type jwtPayload struct {
// JWK is the default provisioner, an entity that can sign tokens necessary for
// signature requests.
type JWK struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Key *jose.JSONWebKey `json:"key,omitempty"`
Type string `json:"type"`
Name string `json:"name"`
Key *jose.JSONWebKey `json:"key"`
EncryptedKey string `json:"encryptedKey,omitempty"`
Claims *Claims `json:"claims,omitempty"`
audiences []string
@ -50,12 +50,10 @@ func (p *JWK) GetEncryptedKey() (string, string, bool) {
// Init initializes and validates the fields of a JWK type.
func (p *JWK) Init(config Config) (err error) {
switch {
case p.Name == "":
return errors.New("provisioner name cannot be empty")
case p.Type == "":
return errors.New("provisioner type cannot be empty")
case p.Name == "":
return errors.New("provisioner name cannot be empty")
case p.Key == nil:
return errors.New("provisioner key cannot be empty")
}

@ -87,6 +87,8 @@ func (o *OIDC) GetEncryptedKey() (kid string, key string, ok bool) {
// Init validates and initializes the OIDC provider.
func (o *OIDC) Init(config Config) (err error) {
switch {
case o.Type == "":
return errors.New("type cannot be empty")
case o.Name == "":
return errors.New("name cannot be empty")
case o.ClientID == "":

Loading…
Cancel
Save