controller/auth: Implement JWT based authorization for controller. (#2544)

Fixes #2474
This commit is contained in:
Harshavardhana
2016-08-24 10:14:14 -07:00
parent 200d327737
commit 9605fde04d
15 changed files with 240 additions and 162 deletions
+2 -3
View File
@@ -17,7 +17,6 @@
package cmd
import (
"errors"
"fmt"
"net/rpc"
"path"
@@ -59,10 +58,10 @@ type lockServer struct {
func (l *lockServer) verifyArgs(args *LockArgs) error {
if !l.timestamp.Equal(args.Timestamp) {
return errors.New("Timestamps don't match, server may have restarted.")
return errInvalidTimestamp
}
if !isRPCTokenValid(args.Token) {
return errors.New("Invalid token")
return errInvalidToken
}
return nil
}