Add projects

This commit is contained in:
Alois 2026-08-24 00:10:41 +02:00
commit 8b607dd700
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
1802 changed files with 503346 additions and 2 deletions

View file

@ -0,0 +1,39 @@
package auth
import "strings"
const (
// CredentialPolicyCodexAlphaSearchV1 selects credentials supported by Codex Alpha Search.
CredentialPolicyCodexAlphaSearchV1 = "codex_alpha_search_v1"
)
func normalizeCredentialPolicy(policy string) string {
switch strings.ToLower(strings.TrimSpace(policy)) {
case CredentialPolicyCodexAlphaSearchV1:
return CredentialPolicyCodexAlphaSearchV1
default:
return ""
}
}
func credentialPolicyAllows(policy string, auth *Auth) bool {
if auth == nil {
return false
}
switch policy {
case CredentialPolicyCodexAlphaSearchV1:
if !strings.EqualFold(strings.TrimSpace(auth.Provider), "codex") {
return false
}
switch auth.AuthKind() {
case AuthKindOAuth:
return true
case AuthKindAPIKey:
return strings.EqualFold(authAttribute(auth, AttributeCodexAlphaSearch), "true")
default:
return false
}
default:
return false
}
}