mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 07:37:56 +08:00
use grpc and jwt
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/raft"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -69,7 +70,7 @@ func (ms *MasterServer) ProcessGrowRequest() {
|
||||
func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupVolumeRequest) (*master_pb.LookupVolumeResponse, error) {
|
||||
|
||||
resp := &master_pb.LookupVolumeResponse{}
|
||||
volumeLocations := ms.lookupVolumeId(req.VolumeIds, req.Collection)
|
||||
volumeLocations := ms.lookupVolumeId(req.VolumeOrFileIds, req.Collection)
|
||||
|
||||
for _, result := range volumeLocations {
|
||||
var locations []*master_pb.Location
|
||||
@@ -79,10 +80,15 @@ func (ms *MasterServer) LookupVolume(ctx context.Context, req *master_pb.LookupV
|
||||
PublicUrl: loc.PublicUrl,
|
||||
})
|
||||
}
|
||||
var auth string
|
||||
if strings.Contains(result.VolumeOrFileId, ",") { // this is a file id
|
||||
auth = string(security.GenJwt(ms.guard.SigningKey, ms.guard.ExpiresAfterSec, result.VolumeOrFileId))
|
||||
}
|
||||
resp.VolumeIdLocations = append(resp.VolumeIdLocations, &master_pb.LookupVolumeResponse_VolumeIdLocation{
|
||||
VolumeId: result.VolumeId,
|
||||
Locations: locations,
|
||||
Error: result.Error,
|
||||
VolumeOrFileId: result.VolumeOrFileId,
|
||||
Locations: locations,
|
||||
Error: result.Error,
|
||||
Auth: auth,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user