mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
s3: keep auth enabled in case identities are set to empty
fix https://github.com/chrislusf/seaweedfs/issues/3084
This commit is contained in:
parent
81d6159290
commit
b8f3db0d46
|
@ -27,6 +27,7 @@ type IdentityAccessManagement struct {
|
|||
m sync.RWMutex
|
||||
|
||||
identities []*Identity
|
||||
isAuthEnabled bool
|
||||
domain string
|
||||
}
|
||||
|
||||
|
@ -137,14 +138,15 @@ func (iam *IdentityAccessManagement) loadS3ApiConfiguration(config *iam_pb.S3Api
|
|||
iam.m.Lock()
|
||||
// atomically switch
|
||||
iam.identities = identities
|
||||
if !iam.isAuthEnabled { // one-directional, no toggling
|
||||
iam.isAuthEnabled = len(identities) > 0
|
||||
}
|
||||
iam.m.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (iam *IdentityAccessManagement) isEnabled() bool {
|
||||
iam.m.RLock()
|
||||
defer iam.m.RUnlock()
|
||||
return len(iam.identities) > 0
|
||||
return iam.isAuthEnabled
|
||||
}
|
||||
|
||||
func (iam *IdentityAccessManagement) lookupByAccessKey(accessKey string) (identity *Identity, cred *Credential, found bool) {
|
||||
|
|
Loading…
Reference in a new issue