macaroons: add ability to change the password or create a new root key

This commit is contained in:
Oliver Gugger committed 2020-11-07 11:24:33 +01:00
1 parent cd85e17b19
commit ae71d60715
3 files changed
+290 -49

No files matched your search

+14 -2
View File
@@ -257,8 +257,8 @@ func (svc *Service) ValidateMacaroon(ctx context.Context,
return err
}
// Check the method being called against the permitted operation and
// the expiration time and IP address and return the result.
// Check the method being called against the permitted operation, the
// expiration time and IP address and return the result.
authChecker := svc.Checker.Auth(macaroon.Slice{mac})
_, err = authChecker.Allow(ctx, requiredPermissions...)
@@ -325,3 +325,15 @@ func (svc *Service) DeleteMacaroonID(ctxt context.Context,
rootKeyID []byte) ([]byte, error) {
return svc.rks.DeleteMacaroonID(ctxt, rootKeyID)
}
// GenerateNewRootKey calls the underlying root key store's GenerateNewRootKey
// and returns the result.
func (svc *Service) GenerateNewRootKey() error {
return svc.rks.GenerateNewRootKey()
}
// ChangePassword calls the underlying root key store's ChangePassword and
// returns the result.
func (svc *Service) ChangePassword(oldPw, newPw []byte) error {
return svc.rks.ChangePassword(oldPw, newPw)
}