mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 20:28:54 +00:00
Create auth.go
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package util
|
||||
|
||||
type AuthStrategyType string
|
||||
|
||||
var AuthStrategy = struct {
|
||||
UNIVERSAL_AUTH AuthStrategyType
|
||||
KUBERNETES_AUTH AuthStrategyType
|
||||
}{
|
||||
UNIVERSAL_AUTH: "universal-auth",
|
||||
KUBERNETES_AUTH: "kubernetes",
|
||||
}
|
||||
|
||||
var AVAILABLE_AUTH_STRATEGIES = []AuthStrategyType{
|
||||
AuthStrategy.UNIVERSAL_AUTH,
|
||||
AuthStrategy.KUBERNETES_AUTH,
|
||||
}
|
||||
|
||||
func IsAuthMethodValid(authMethod string) (isValid bool, strategy AuthStrategyType) {
|
||||
|
||||
if authMethod == "user" {
|
||||
return true, ""
|
||||
}
|
||||
|
||||
for _, strategy := range AVAILABLE_AUTH_STRATEGIES {
|
||||
if string(strategy) == authMethod {
|
||||
return true, strategy
|
||||
}
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
Reference in New Issue
Block a user