Skip to content

Commit

Permalink
feat: add support for several organizations
Browse files Browse the repository at this point in the history
Required for RBAC.

Signed-off-by: Alexey Palazhchenko <[email protected]>
  • Loading branch information
AlekSi authored and talos-bot committed Jun 1, 2021
1 parent 97c888b commit cd18ef6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x509/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type PEMEncodedKey struct {
//nolint:govet
type Options struct {
CommonName string
Organization string
Organizations []string
SignatureAlgorithm x509.SignatureAlgorithm
IPAddresses []net.IP
DNSNames []string
Expand All @@ -119,10 +119,10 @@ func CommonName(o string) Option {
}
}

// Organization sets the subject organization of the certificate.
func Organization(o string) Option {
// Organization sets the subject organizations of the certificate.
func Organization(o ...string) Option {
return func(opts *Options) {
opts.Organization = o
opts.Organizations = o
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ func NewSelfSignedCertificateAuthority(setters ...Option) (*CertificateAuthority
crt := &x509.Certificate{
SerialNumber: serialNumber,
Subject: pkix.Name{
Organization: []string{opts.Organization},
Organization: opts.Organizations,
},
SignatureAlgorithm: opts.SignatureAlgorithm,
NotBefore: opts.NotBefore,
Expand Down Expand Up @@ -292,7 +292,7 @@ func NewCertificateSigningRequest(key interface{}, setters ...Option) (*Certific
DNSNames: opts.DNSNames,
Subject: pkix.Name{
CommonName: opts.CommonName,
Organization: []string{opts.Organization},
Organization: opts.Organizations,
},
}

Expand Down

0 comments on commit cd18ef6

Please sign in to comment.