Merge pull request #130 from openziti/fix.change.password

Fix.change.password
This commit is contained in:
Andrew
2020-06-30 09:02:38 -04:00
committed by GitHub
4 changed files with 29 additions and 9 deletions
+1
View File
@@ -4,6 +4,7 @@
* Bug fixes
* [#129](https://github.com/openziti/ziti/issues/129) - minor issue with `ziti-tunnel enroll` outputting the success message at ERROR level
* [edge#191](https://github.com/openziti/edge/issues/191) - updating self password via CLI would error with 404 not found
# Release 0.15.0
Ziti 0.15.0 includes the following:
+2 -2
View File
@@ -25,10 +25,10 @@ require (
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
github.com/michaelquigley/pfxlog v0.0.0-20190813191113-2be43bd0dccc
github.com/openziti/edge v0.15.6
github.com/openziti/edge v0.15.9
github.com/openziti/fabric v0.11.52
github.com/openziti/foundation v0.11.10
github.com/openziti/sdk-golang v0.13.16
github.com/openziti/sdk-golang v0.13.18
github.com/pborman/uuid v1.2.0
github.com/pkg/errors v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
+4 -4
View File
@@ -322,14 +322,14 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/openziti/edge v0.15.6 h1:i2vaMfqLrjxNFGskEJ5PHEe0MRWPtGI9R3BQQnYMtFY=
github.com/openziti/edge v0.15.6/go.mod h1:rsXJeirQPTxggP2BOvX1iS1SRT3Fb9FM/+IMyFctXR8=
github.com/openziti/edge v0.15.9 h1:hwYc/gGz88Vg/Khv+2oC6q01Q9URAlbO1AzPGwrqL/c=
github.com/openziti/edge v0.15.9/go.mod h1:Kd7Jf+Gts0hYZDhkR9bHK9BZIP+0SYuCGl8rC2K5oRo=
github.com/openziti/fabric v0.11.52 h1:Fugq+7l+0K3wQ7B2OmVs/U7N7fSYV3FrVSitLsI9pg4=
github.com/openziti/fabric v0.11.52/go.mod h1:elWkCKKtfE7FaqVx8Th++KifopbKzFGpBxp3A+FGSfA=
github.com/openziti/foundation v0.11.10 h1:ot2cmzNgaPttc59gCflJr9MUHy9rSYH+V/rjhNqXIrg=
github.com/openziti/foundation v0.11.10/go.mod h1:Qdd7eCuTrpRwEeDbvYy89sFbEY4+J7OuX8UygxNBsvY=
github.com/openziti/sdk-golang v0.13.16 h1:UpGn413RbDh9os6L4aKkNlK0SV6Rxojy6YonuzNGBDc=
github.com/openziti/sdk-golang v0.13.16/go.mod h1:QbZy932p/pVPPBWicQ4TWFtTN1fDhmWohH/SSLvOHeM=
github.com/openziti/sdk-golang v0.13.18 h1:FroO8ub00+CZoH8uKdcuZLSLZbdj3vcI0W4DG5PBfJE=
github.com/openziti/sdk-golang v0.13.18/go.mod h1:1J7RGMfTDio9DWw8//fjtFfEUEwJuBBpE4/VlbAW8m8=
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6 h1:lNCW6THrCKBiJBpz8kbVGjC7MgdCGKwuvBgc7LoD6sw=
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
@@ -21,6 +21,7 @@ import (
"fmt"
"github.com/Jeffail/gabs"
"github.com/openziti/foundation/util/term"
"github.com/openziti/ziti/ziti/cmd/ziti/util"
"github.com/spf13/cobra"
)
import cmdhelper "github.com/openziti/ziti/ziti/cmd/ziti/cmd/helpers"
@@ -96,10 +97,28 @@ func updateSelfPassword(current string, new string, options commonOptions) error
}
passwordData := gabs.New()
setJSONValue(passwordData, current, "current")
setJSONValue(passwordData, new, "new")
setJSONValue(passwordData, current, "currentPassword")
setJSONValue(passwordData, new, "password")
_, err = putEntityOfType("current-identity/updb/password", passwordData.String(), &options)
respEnvelope, err := util.EdgeControllerList("current-identity/authenticators", map[string][]string{"filter": {`method="updb"`}}, options.OutputJSONResponse, options.Out)
if err != nil {
return err
}
authenticators, err := respEnvelope.S("data").Children()
if err != nil {
return err
}
if len(authenticators) == 0 {
return errors.New("no updb authenticator found for the current identity")
} else if len(authenticators) > 1 {
return errors.New("too many updb authenticator found for the current identity")
}
_, err = patchEntityOfType("current-identity/authenticators/"+authenticators[0].Path("id").Data().(string), passwordData.String(), &options)
if err != nil {
return err