summaryrefslogtreecommitdiff
path: root/path_config.go
diff options
context:
space:
mode:
authorAria <me@aria.rip>2023-10-01 23:41:37 +0100
committerAria <me@aria.rip>2023-10-01 23:41:37 +0100
commit0e5077d427dc144ab70f208a4794a903d5e8a5a8 (patch)
treee23e7726d63d75a76338bab7f7ad7432de40a951 /path_config.go
parent7045a630996e08c18beb7c3d39e1b2752c8a4ba4 (diff)
a working version with principal creationHEADmain
Diffstat (limited to 'path_config.go')
-rw-r--r--path_config.go43
1 files changed, 10 insertions, 33 deletions
diff --git a/path_config.go b/path_config.go
index 8a3187e..0fcec4c 100644
--- a/path_config.go
+++ b/path_config.go
@@ -71,21 +71,12 @@ func configSchema() map[string]*framework.FieldSchema {
Sensitive: true,
},
},
- "kdc": {
- Type: framework.TypeCommaStringSlice,
- Description: "Available KDCs for the realm",
- Required: true,
- DisplayAttrs: &framework.DisplayAttributes{
- Name: "KDCs",
- Sensitive: false,
- },
- },
- "kpasswd_server": {
- Type: framework.TypeCommaStringSlice,
- Description: "KPasswd servers for the realm",
+ "kadmin_server": {
+ Type: framework.TypeString,
+ Description: "KAdmin server for the realm",
Required: true,
DisplayAttrs: &framework.DisplayAttributes{
- Name: "KPasswd Servers",
+ Name: "KAdmin Server",
Sensitive: false,
},
},
@@ -116,10 +107,9 @@ func (b *krbBackend) pathConfigRead(ctx context.Context, req *logical.Request, d
return &logical.Response{
Data: map[string]interface{}{
- "realm": config.Realm,
- "kdc": config.KDC,
- "kpasswd_server": config.KPasswdServer,
- "username": config.Username,
+ "realm": config.Realm,
+ "kadmin_server": config.KAdminServer,
+ "username": config.Username,
},
}, nil
}
@@ -146,23 +136,10 @@ func (b *krbBackend) pathConfigWrite(ctx context.Context, req *logical.Request,
return nil, fmt.Errorf("missing realm in configuration")
}
- // TODO: Also validate these aren't empty
- if kdc, ok := data.GetOk("kdc"); ok {
- c.KDC = kdc.([]string)
+ if kpasswd_server, ok := data.GetOk("kadmin_server"); ok {
+ c.KAdminServer = kpasswd_server.(string)
} else if !ok && createOperation {
- return nil, fmt.Errorf("missing KDCs in configuration")
- }
- if len(c.KDC) == 0 {
- return nil, fmt.Errorf("no KDCs specified")
- }
-
- if kpasswd_server, ok := data.GetOk("kpasswd_server"); ok {
- c.KPasswdServer = kpasswd_server.([]string)
- } else if !ok && createOperation {
- return nil, fmt.Errorf("missing kpasswd servers in configuration")
- }
- if len(c.KPasswdServer) == 0 {
- return nil, fmt.Errorf("no kpasswd servers specified")
+ return nil, fmt.Errorf("missing kadmin server in configuration")
}
if username, ok := data.GetOk("username"); ok {