mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
Move LoginHandler into LoginServer which others embed (#3431)
* Move LoginHandler into LoginServer which others embed * Add unit tests for loginServer
This commit is contained in:
committed by
Harshavardhana
parent
2d6f8153fa
commit
6b4e6bcebf
@@ -29,32 +29,12 @@ import (
|
||||
// Storage server implements rpc primitives to facilitate exporting a
|
||||
// disk over a network.
|
||||
type storageServer struct {
|
||||
loginServer
|
||||
storage StorageAPI
|
||||
path string
|
||||
timestamp time.Time
|
||||
}
|
||||
|
||||
/// Auth operations
|
||||
|
||||
// Login - login handler.
|
||||
func (s *storageServer) LoginHandler(args *RPCLoginArgs, reply *RPCLoginReply) error {
|
||||
jwt, err := newJWT(defaultInterNodeJWTExpiry, serverConfig.GetCredential())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = jwt.Authenticate(args.Username, args.Password); err != nil {
|
||||
return err
|
||||
}
|
||||
token, err := jwt.GenerateToken(args.Username)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply.Token = token
|
||||
reply.Timestamp = time.Now().UTC()
|
||||
reply.ServerVersion = Version
|
||||
return nil
|
||||
}
|
||||
|
||||
/// Storage operations handlers.
|
||||
|
||||
// DiskInfoHandler - disk info handler is rpc wrapper for DiskInfo operation.
|
||||
|
||||
Reference in New Issue
Block a user