github.com/cyverse/go-irodsclient@v0.13.2/irods/types/auth.go (about) 1 package types 2 3 import ( 4 "strings" 5 6 "golang.org/x/xerrors" 7 ) 8 9 // AuthScheme defines Authentication Scheme 10 type AuthScheme string 11 12 const ( 13 // AuthSchemeNative uses Native authentication scheme 14 AuthSchemeNative AuthScheme = "native" 15 // AuthSchemeGSI uses GSI authentication scheme 16 AuthSchemeGSI AuthScheme = "gsi" 17 // AuthSchemePAM uses PAM authentication scheme 18 AuthSchemePAM AuthScheme = "pam" 19 ) 20 21 // GetAuthScheme returns AuthScheme value from string 22 func GetAuthScheme(authScheme string) (AuthScheme, error) { 23 switch strings.TrimSpace(strings.ToLower(authScheme)) { 24 case string(AuthSchemeNative), "": 25 return AuthSchemeNative, nil 26 case string(AuthSchemeGSI): 27 return AuthSchemeGSI, nil 28 case string(AuthSchemePAM), "pam_password": 29 return AuthSchemePAM, nil 30 default: 31 return AuthSchemeNative, xerrors.Errorf("cannot parse string %s", authScheme) 32 } 33 }