Skip to content

Commit

Permalink
Export ProfileConfig.Name field
Browse files Browse the repository at this point in the history
  • Loading branch information
pgporada committed Feb 17, 2024
1 parent cc026bb commit 800b3c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func makeCertificateProfilesMap(origProfile *issuance.Profile, certProfiles []*i

profilesByName := make(map[string]*issuance.Profile, len(allProfiles))
for _, profile := range allProfiles {
if profilesByName[profile.Name()] == nil {
profilesByName[profile.Name()] = profile
if profilesByName[profile.Name] == nil {
profilesByName[profile.Name] = profile
} else {
return nil, fmt.Errorf("duplicate certificate profile name %+v", profile)
}
Expand Down
15 changes: 3 additions & 12 deletions issuance/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

// ProfileConfig describes the certificate issuance constraints for all issuers.
type ProfileConfig struct {
name string
Name string
AllowMustStaple bool
AllowCTPoison bool
AllowSCTList bool
Expand All @@ -48,7 +48,7 @@ type PolicyConfig struct {

// Profile is the validated structure created by reading in ProfileConfigs and IssuerConfigs
type Profile struct {
name string
Name string
allowMustStaple bool
allowCTPoison bool
allowSCTList bool
Expand All @@ -60,11 +60,6 @@ type Profile struct {
lints lint.Registry
}

// Name gets the human-readable name of a certificate profile.
func (p *Profile) Name() string {
return p.name
}

// NewProfile synthesizes the profile config and issuer config into a single
// object, and checks various aspects for correctness.
func NewProfile(profileConfig ProfileConfig, skipLints []string) (*Profile, error) {
Expand All @@ -74,11 +69,7 @@ func NewProfile(profileConfig ProfileConfig, skipLints []string) (*Profile, erro
}

sp := &Profile{
// TODO(@pgporada): Once the issuance.ProfileConfig name field is
// exported and we can begin using multiple profiles, allow for an
// operator to configure a profile name, but use a default name when one
// is not provided.
name: "defaultCertificateProfileName",
Name: "defaultCertificateProfileName",
allowMustStaple: profileConfig.AllowMustStaple,
allowCTPoison: profileConfig.AllowCTPoison,
allowSCTList: profileConfig.AllowSCTList,
Expand Down
2 changes: 1 addition & 1 deletion issuance/issuer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func defaultProfileConfig() ProfileConfig {
return ProfileConfig{
name: "testCertProfileName",
Name: "testCertProfileName",
AllowCommonName: true,
AllowCTPoison: true,
AllowSCTList: true,
Expand Down

0 comments on commit 800b3c5

Please sign in to comment.