You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
smallstep-certificates/authority/mgmt/config.go

49 lines
1.2 KiB
Go

3 years ago
package mgmt
const (
3 years ago
// DefaultAuthorityID is the default AuthorityID. This will be the ID
// of the first Authority created, as well as the default AuthorityID
// if one is not specified in the configuration.
3 years ago
DefaultAuthorityID = "00000000-0000-0000-0000-000000000000"
)
3 years ago
/*
3 years ago
func CreateAuthority(ctx context.Context, db DB, options ...AuthorityOption) (*AuthConfig, error) {
ac := NewDefaultAuthConfig()
3 years ago
3 years ago
for _, o := range options {
if err := o(ac); err != nil {
3 years ago
return nil, err
}
}
3 years ago
if err := db.CreateAuthConfig(ctx, ac); err != nil {
return nil, errors.Wrap(err, "error creating authConfig")
3 years ago
}
3 years ago
// Generate default JWK provisioner.
3 years ago
3 years ago
provOpts := []ProvisionerOption{WithPassword("pass")}
prov, err := CreateProvisioner(ctx, db, "JWK", "changeme", provOpts...)
3 years ago
if err != nil {
3 years ago
// TODO should we try to clean up?
return nil, WrapErrorISE(err, "error creating first provisioner")
3 years ago
}
3 years ago
adm := &Admin{
ProvisionerID: prov.ID,
Subject: "Change Me",
Type: AdminTypeSuper,
}
if err := db.CreateAdmin(ctx, adm); err != nil {
3 years ago
// TODO should we try to clean up?
3 years ago
return nil, WrapErrorISE(err, "error creating first admin")
3 years ago
}
3 years ago
ac.Provisioners = []*Provisioner{prov}
3 years ago
ac.Admins = []*Admin{adm}
3 years ago
return ac, nil
3 years ago
}
3 years ago
*/