forked from minio/minio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth-providers.go
More file actions
43 lines (36 loc) · 870 Bytes
/
auth-providers.go
File metadata and controls
43 lines (36 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package cmd
import (
"fmt"
"sync"
)
type authProviders struct {
sync.RWMutex
SAML samlProvider `json:"saml"`
// Add new auth providers.
}
const minioIAM = "arn:minio:iam:"
func (a *authProviders) GetAllAuthProviders() map[string]struct{} {
authProviderArns := make(map[string]struct{})
if a.SAML.Enable {
// Construct the auth ARN.
authARN := minioIAM + serverConfig.GetRegion() + ":1:saml"
authProviderArns[authARN] = struct{}{}
}
return authProviderArns
}
func (a *authProviders) GetSAML() samlProvider {
a.RLock()
defer a.RUnlock()
return a.SAML
}
type samlProvider struct {
Enable bool `json:"enable"`
IDPURL string `json:"idp"`
RootURL string `json:"sp"`
}
func (s samlProvider) Validate() error {
if s.IDPURL != "" && s.RootURL != "" && s.Enable {
return nil
}
return fmt.Errorf("Invalid saml provider configuration %#v", s)
}