macaroons: add ability to change the password or create a new root key
This commit is contained in:
3 files changed
+290
-49
No files matched your search
+14
-2
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user