mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: check authinfo if it is not InternalAuthenticateRequest.
Signed-off-by: Chao Chen <chaochn@amazon.com>
This commit is contained in:
parent
e031012f74
commit
1fc259d655
@ -703,13 +703,16 @@ func (s *EtcdServer) processInternalRaftRequestOnce(ctx context.Context, r pb.In
|
||||
ID: s.reqIDGen.Next(),
|
||||
}
|
||||
|
||||
authInfo, err := s.AuthInfoFromCtx(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if authInfo != nil {
|
||||
r.Header.Username = authInfo.Username
|
||||
r.Header.AuthRevision = authInfo.Revision
|
||||
// check authinfo if it is not InternalAuthenticateRequest
|
||||
if r.Authenticate == nil {
|
||||
authInfo, err := s.AuthInfoFromCtx(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if authInfo != nil {
|
||||
r.Header.Username = authInfo.Username
|
||||
r.Header.AuthRevision = authInfo.Revision
|
||||
}
|
||||
}
|
||||
|
||||
data, err := r.Marshal()
|
||||
|
Loading…
x
Reference in New Issue
Block a user