mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-24 02:03:38 +08:00
refactoring
This commit is contained in:
@@ -91,7 +91,13 @@ func (iam *IdentityAccessManagement) loadS3ApiConfiguration(fileName string) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (iam *IdentityAccessManagement) isEnabled() bool {
|
||||||
|
|
||||||
|
return len(iam.identities) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (iam *IdentityAccessManagement) lookupByAccessKey(accessKey string) (identity *Identity, cred *Credential, found bool) {
|
func (iam *IdentityAccessManagement) lookupByAccessKey(accessKey string) (identity *Identity, cred *Credential, found bool) {
|
||||||
|
|
||||||
for _, ident := range iam.identities {
|
for _, ident := range iam.identities {
|
||||||
for _, cred := range ident.Credentials {
|
for _, cred := range ident.Credentials {
|
||||||
if cred.AccessKey == accessKey {
|
if cred.AccessKey == accessKey {
|
||||||
@@ -104,7 +110,7 @@ func (iam *IdentityAccessManagement) lookupByAccessKey(accessKey string) (identi
|
|||||||
|
|
||||||
func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) http.HandlerFunc {
|
func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) http.HandlerFunc {
|
||||||
|
|
||||||
if len(iam.identities) == 0 {
|
if iam.isEnabled() {
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user