forked from Versent/saml2aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
saml2aws.go
42 lines (36 loc) · 882 Bytes
/
saml2aws.go
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
package saml2aws
import "fmt"
// Provider the SAML provider
type Provider int
const (
// ADFS 3.x provider
ADFS Provider = iota
// Ping provider
Ping
)
// SAMLClient client interface
type SAMLClient interface {
Authenticate(loginDetails *LoginDetails) (string, error)
}
// SAMLOptions options for the new SAML client
type SAMLOptions struct {
SkipVerify bool
Provider string
}
// NewSAMLClient create a new SAML client
func NewSAMLClient(opts *SAMLOptions) (SAMLClient, error) {
switch opts.Provider {
case "ADFS":
return NewADFSClient(opts.SkipVerify)
case "ADFS2":
return NewADFS2Client(opts.SkipVerify)
case "Ping":
return NewPingFedClient(opts.SkipVerify)
case "JumpCloud":
return NewJumpCloudClient(opts.SkipVerify)
case "Okta":
return NewOktaClient(opts.SkipVerify)
default:
return nil, fmt.Errorf("Invalid provider: %v", opts.Provider)
}
}