forked from TrueCloudLab/certificates
Move type to the first position of the struct.
This commit is contained in:
parent
23e6de57a2
commit
0b4cde1ad3
2 changed files with 7 additions and 7 deletions
|
@ -18,9 +18,9 @@ type jwtPayload struct {
|
||||||
// JWK is the default provisioner, an entity that can sign tokens necessary for
|
// JWK is the default provisioner, an entity that can sign tokens necessary for
|
||||||
// signature requests.
|
// signature requests.
|
||||||
type JWK struct {
|
type JWK struct {
|
||||||
Name string `json:"name,omitempty"`
|
Type string `json:"type"`
|
||||||
Type string `json:"type,omitempty"`
|
Name string `json:"name"`
|
||||||
Key *jose.JSONWebKey `json:"key,omitempty"`
|
Key *jose.JSONWebKey `json:"key"`
|
||||||
EncryptedKey string `json:"encryptedKey,omitempty"`
|
EncryptedKey string `json:"encryptedKey,omitempty"`
|
||||||
Claims *Claims `json:"claims,omitempty"`
|
Claims *Claims `json:"claims,omitempty"`
|
||||||
audiences []string
|
audiences []string
|
||||||
|
@ -50,12 +50,10 @@ func (p *JWK) GetEncryptedKey() (string, string, bool) {
|
||||||
// Init initializes and validates the fields of a JWK type.
|
// Init initializes and validates the fields of a JWK type.
|
||||||
func (p *JWK) Init(config Config) (err error) {
|
func (p *JWK) Init(config Config) (err error) {
|
||||||
switch {
|
switch {
|
||||||
case p.Name == "":
|
|
||||||
return errors.New("provisioner name cannot be empty")
|
|
||||||
|
|
||||||
case p.Type == "":
|
case p.Type == "":
|
||||||
return errors.New("provisioner type cannot be empty")
|
return errors.New("provisioner type cannot be empty")
|
||||||
|
case p.Name == "":
|
||||||
|
return errors.New("provisioner name cannot be empty")
|
||||||
case p.Key == nil:
|
case p.Key == nil:
|
||||||
return errors.New("provisioner key cannot be empty")
|
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.
|
// Init validates and initializes the OIDC provider.
|
||||||
func (o *OIDC) Init(config Config) (err error) {
|
func (o *OIDC) Init(config Config) (err error) {
|
||||||
switch {
|
switch {
|
||||||
|
case o.Type == "":
|
||||||
|
return errors.New("type cannot be empty")
|
||||||
case o.Name == "":
|
case o.Name == "":
|
||||||
return errors.New("name cannot be empty")
|
return errors.New("name cannot be empty")
|
||||||
case o.ClientID == "":
|
case o.ClientID == "":
|
||||||
|
|
Loading…
Reference in a new issue