Sfoglia il codice sorgente

claims.SANS -> claims.SANs

max furman 7 anni fa
parent
commit
6937bfea7b
2 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 6 6
      authority/authorize.go
  2. 1 1
      ca/client.go

+ 6 - 6
authority/authorize.go

@@ -20,7 +20,7 @@ type idUsed struct {
 // Claims extends jwt.Claims with step attributes.
 // Claims extends jwt.Claims with step attributes.
 type Claims struct {
 type Claims struct {
 	jwt.Claims
 	jwt.Claims
-	SANS []string `json:"sans,omitempty"`
+	SANs []string `json:"sans,omitempty"`
 }
 }
 
 
 // matchesAudience returns true if A and B share at least one element.
 // matchesAudience returns true if A and B share at least one element.
@@ -123,10 +123,10 @@ func (a *Authority) Authorize(ott string) ([]interface{}, error) {
 	// NOTE: This is for backwards compatibility with older versions of cli
 	// NOTE: This is for backwards compatibility with older versions of cli
 	// and certificates. Older versions added the token subject as the only SAN
 	// and certificates. Older versions added the token subject as the only SAN
 	// in a CSR by default.
 	// in a CSR by default.
-	if len(claims.SANS) == 0 {
-		claims.SANS = []string{claims.Subject}
+	if len(claims.SANs) == 0 {
+		claims.SANs = []string{claims.Subject}
 	}
 	}
-	dnsNames, ips := SplitSANS(claims.SANS)
+	dnsNames, ips := SplitSANs(claims.SANs)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -150,10 +150,10 @@ func (a *Authority) Authorize(ott string) ([]interface{}, error) {
 	return signOps, nil
 	return signOps, nil
 }
 }
 
 
-// SplitSANS splits a slice of Subject Alternative Names into slices of
+// SplitSANs splits a slice of Subject Alternative Names into slices of
 // IP Addresses and DNS Names. If an element is not an IP address, then it
 // IP Addresses and DNS Names. If an element is not an IP address, then it
 // is bucketed as a DNS Name.
 // is bucketed as a DNS Name.
-func SplitSANS(sans []string) (dnsNames []string, ips []net.IP) {
+func SplitSANs(sans []string) (dnsNames []string, ips []net.IP) {
 	dnsNames = []string{}
 	dnsNames = []string{}
 	ips = []net.IP{}
 	ips = []net.IP{}
 	if sans == nil {
 	if sans == nil {

+ 1 - 1
ca/client.go

@@ -452,7 +452,7 @@ func CreateSignRequest(ott string) (*api.SignRequest, crypto.PrivateKey, error)
 		return nil, nil, errors.Wrap(err, "error generating key")
 		return nil, nil, errors.Wrap(err, "error generating key")
 	}
 	}
 
 
-	dnsNames, ips := authority.SplitSANS(claims.SANS)
+	dnsNames, ips := authority.SplitSANs(claims.SANs)
 
 
 	template := &x509.CertificateRequest{
 	template := &x509.CertificateRequest{
 		Subject: pkix.Name{
 		Subject: pkix.Name{