diff options
Diffstat (limited to 'path_config.go')
-rw-r--r-- | path_config.go | 43 |
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 { |