feat(idp_table_relational): adding inital idp tables for relational repository (#10334)

This commit is contained in:
Iraq
2025-09-24 13:19:09 +00:00
committed by GitHub
parent cccfc816f6
commit 08f41e034e
19 changed files with 10917 additions and 37 deletions
@@ -0,0 +1,82 @@
// Code generated by "enumer -type AzureTenantType -transform lower -trimprefix AzureTenantType"; DO NOT EDIT.
package domain
import (
"fmt"
"strings"
)
const _AzureTenantTypeName = "commonorganizationsconsumers"
var _AzureTenantTypeIndex = [...]uint8{0, 6, 19, 28}
const _AzureTenantTypeLowerName = "commonorganizationsconsumers"
func (i AzureTenantType) String() string {
if i >= AzureTenantType(len(_AzureTenantTypeIndex)-1) {
return fmt.Sprintf("AzureTenantType(%d)", i)
}
return _AzureTenantTypeName[_AzureTenantTypeIndex[i]:_AzureTenantTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _AzureTenantTypeNoOp() {
var x [1]struct{}
_ = x[AzureTenantTypeCommon-(0)]
_ = x[AzureTenantTypeOrganizations-(1)]
_ = x[AzureTenantTypeConsumers-(2)]
}
var _AzureTenantTypeValues = []AzureTenantType{AzureTenantTypeCommon, AzureTenantTypeOrganizations, AzureTenantTypeConsumers}
var _AzureTenantTypeNameToValueMap = map[string]AzureTenantType{
_AzureTenantTypeName[0:6]: AzureTenantTypeCommon,
_AzureTenantTypeLowerName[0:6]: AzureTenantTypeCommon,
_AzureTenantTypeName[6:19]: AzureTenantTypeOrganizations,
_AzureTenantTypeLowerName[6:19]: AzureTenantTypeOrganizations,
_AzureTenantTypeName[19:28]: AzureTenantTypeConsumers,
_AzureTenantTypeLowerName[19:28]: AzureTenantTypeConsumers,
}
var _AzureTenantTypeNames = []string{
_AzureTenantTypeName[0:6],
_AzureTenantTypeName[6:19],
_AzureTenantTypeName[19:28],
}
// AzureTenantTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func AzureTenantTypeString(s string) (AzureTenantType, error) {
if val, ok := _AzureTenantTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _AzureTenantTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to AzureTenantType values", s)
}
// AzureTenantTypeValues returns all values of the enum
func AzureTenantTypeValues() []AzureTenantType {
return _AzureTenantTypeValues
}
// AzureTenantTypeStrings returns a slice of all String values of the enum
func AzureTenantTypeStrings() []string {
strs := make([]string, len(_AzureTenantTypeNames))
copy(strs, _AzureTenantTypeNames)
return strs
}
// IsAAzureTenantType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i AzureTenantType) IsAAzureTenantType() bool {
for _, v := range _AzureTenantTypeValues {
if i == v {
return true
}
}
return false
}
+26 -4
View File
@@ -1,7 +1,29 @@
package domain
import "errors"
var (
ErrNoAdminSpecified = errors.New("at least one admin must be specified")
import (
"errors"
"fmt"
)
var ErrNoAdminSpecified = errors.New("at least one admin must be specified")
type wrongIDPTypeError struct {
expected IDPType
got string
}
func NewIDPWrongTypeError(expected IDPType, got fmt.Stringer) error {
return &wrongIDPTypeError{
expected: expected,
got: got.String(),
}
}
func (e *wrongIDPTypeError) Error() string {
return fmt.Sprintf("wrong idp type returned, expected: %v, got: %v", e.expected, e.got)
}
func (e *wrongIDPTypeError) Is(target error) bool {
_, ok := target.(*wrongIDPTypeError)
return ok
}
+355
View File
@@ -0,0 +1,355 @@
package domain
import (
"context"
"encoding/json"
"time"
"github.com/zitadel/zitadel/backend/v3/storage/database"
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/domain"
)
//go:generate enumer -type IDPType -transform lower -trimprefix IDPType
type IDPType uint8
const (
IDPTypeOIDC IDPType = iota + 1
IDPTypeJWT
IDPTypeOAuth
IDPTypeSAML
IDPTypeLDAP
IDPTypeGitHub
IDPTypeGitHubEnterprise
IDPTypeGitLab
IDPTypeGitLabSelfHosted
IDPTypeAzure
IDPTypeGoogle
IDPTypeApple
)
//go:generate enumer -type IDPState -transform lower -trimprefix IDPState -sql
type IDPState uint8
const (
IDPStateActive IDPState = iota
IDPStateInactive
)
//go:generate enumer -type IDPAutoLinkingField -transform lower -trimprefix IDPAutoLinkingField
type IDPAutoLinkingField uint8
const (
IDPAutoLinkingFieldUserName IDPAutoLinkingField = iota + 1
IDPAutoLinkingFieldEmail
)
type OIDCMappingField int8
const (
OIDCMappingFieldUnspecified OIDCMappingField = iota
OIDCMappingFieldPreferredLoginName
OIDCMappingFieldEmail
// count is for validation purposes
//nolint: unused
oidcMappingFieldCount
)
type IdentityProvider struct {
InstanceID string `json:"instanceId,omitempty" db:"instance_id"`
OrgID *string `json:"orgId,omitempty" db:"org_id"`
ID string `json:"id,omitempty" db:"id"`
State IDPState `json:"state,omitempty" db:"state"`
Name string `json:"name,omitempty" db:"name"`
// Type represents the type of and idp. It is a pointer because it can be nil during the migration of the events
Type *IDPType `json:"type,omitempty" db:"type"`
AllowCreation bool `json:"allowCreation,omitempty" db:"allow_creation"`
AutoRegister bool `json:"autoRegister,omitempty" db:"auto_register"`
AllowAutoCreation bool `json:"allowAutoCreation,omitempty" db:"allow_auto_creation"`
AllowAutoUpdate bool `json:"allowAutoUpdate,omitempty" db:"allow_auto_update"`
AllowLinking bool `json:"allowLinking,omitempty" db:"allow_linking"`
AutoLinkingField *IDPAutoLinkingField `json:"autoLinkingField,omitempty" db:"auto_linking_field"`
StylingType *int16 `json:"stylingType,omitempty" db:"styling_type"`
Payload json.RawMessage `json:"payload,omitempty" db:"payload"`
CreatedAt time.Time `json:"createdAt,omitzero" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt,omitzero" db:"updated_at"`
}
type OIDC struct {
ClientID string `json:"clientId,omitempty"`
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
Issuer string `json:"issuer,omitempty"`
AuthorizationEndpoint string `json:"authorizationEndpoint,omitempty"`
TokenEndpoint string `json:"tokenEndpoint,omitempty"`
Scopes []string `json:"scopes,omitempty"`
IDPDisplayNameMapping OIDCMappingField `json:"IDPDisplayNameMapping,omitempty"`
UserNameMapping OIDCMappingField `json:"usernameMapping,omitempty"`
IsIDTokenMapping bool `json:"idTokenMapping,omitempty"`
UsePKCE bool `json:"usePKCE,omitempty"`
}
type IDPOIDC struct {
*IdentityProvider
OIDC
}
type JWT struct {
IDPConfigID string `json:"idpConfigId"`
JWTEndpoint string `json:"jwtEndpoint,omitempty"`
Issuer string `json:"issuer,omitempty"`
KeysEndpoint string `json:"keysEndpoint,omitempty"`
HeaderName string `json:"headerName,omitempty"`
}
type IDPJWT struct {
*IdentityProvider
JWT
}
type OAuth struct {
ClientID string `json:"clientId,omitempty"`
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
AuthorizationEndpoint string `json:"authorizationEndpoint,omitempty"`
TokenEndpoint string `json:"tokenEndpoint,omitempty"`
UserEndpoint string `json:"userEndpoint,omitempty"`
Scopes []string `json:"scopes,omitempty"`
IDAttribute string `json:"idAttribute,omitempty"`
UsePKCE bool `json:"usePKCE,omitempty"`
}
type IDPOAuth struct {
*IdentityProvider
OAuth
}
//go:generate enumer -type AzureTenantType -transform lower -trimprefix AzureTenantType
type AzureTenantType uint8
const (
AzureTenantTypeCommon AzureTenantType = iota
AzureTenantTypeOrganizations
AzureTenantTypeConsumers
)
type Azure struct {
ClientID string `json:"client_id,omitempty"`
ClientSecret *crypto.CryptoValue `json:"client_secret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Tenant AzureTenantType `json:"tenant,omitempty"`
IsEmailVerified bool `json:"isEmailVerified,omitempty"`
}
type IDPAzureAD struct {
*IdentityProvider
Azure
}
type Google struct {
ClientID string `json:"clientId"`
ClientSecret *crypto.CryptoValue `json:"clientSecret"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGoogle struct {
*IdentityProvider
Google
}
type Github struct {
ClientID string `json:"clientId"`
ClientSecret *crypto.CryptoValue `json:"clientSecret"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGithub struct {
*IdentityProvider
Github
}
type GithubEnterprise struct {
ClientID string `json:"clientId,omitempty"`
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
AuthorizationEndpoint string `json:"authorizationEndpoint,omitempty"`
TokenEndpoint string `json:"tokenEndpoint,omitempty"`
UserEndpoint string `json:"userEndpoint,omitempty"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGithubEnterprise struct {
*IdentityProvider
GithubEnterprise
}
type Gitlab struct {
ClientID string `json:"clientId,omitempty"`
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGitlab struct {
*IdentityProvider
Gitlab
}
type GitlabSelfHosting struct {
Issuer string `json:"issuer"`
ClientID string `json:"clientId,omitempty"`
ClientSecret *crypto.CryptoValue `json:"clientSecret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGitlabSelfHosting struct {
*IdentityProvider
GitlabSelfHosting
}
type LDAP struct {
Servers []string `json:"servers"`
StartTLS bool `json:"startTLS"`
BaseDN string `json:"baseDN"`
BindDN string `json:"bindDN"`
BindPassword *crypto.CryptoValue `json:"bindPassword"`
UserBase string `json:"userBase"`
UserObjectClasses []string `json:"userObjectClasses"`
UserFilters []string `json:"userFilters"`
Timeout time.Duration `json:"timeout"`
RootCA []byte `json:"rootCA"`
LDAPAttributes
}
type LDAPAttributes struct {
IDAttribute string `json:"idAttribute,omitempty"`
FirstNameAttribute string `json:"firstNameAttribute,omitempty"`
LastNameAttribute string `json:"lastNameAttribute,omitempty"`
DisplayNameAttribute string `json:"displayNameAttribute,omitempty"`
NickNameAttribute string `json:"nickNameAttribute,omitempty"`
PreferredUsernameAttribute string `json:"preferredUsernameAttribute,omitempty"`
EmailAttribute string `json:"emailAttribute,omitempty"`
EmailVerifiedAttribute string `json:"emailVerifiedAttribute,omitempty"`
PhoneAttribute string `json:"phoneAttribute,omitempty"`
PhoneVerifiedAttribute string `json:"phoneVerifiedAttribute,omitempty"`
PreferredLanguageAttribute string `json:"preferredLanguageAttribute,omitempty"`
AvatarURLAttribute string `json:"avatarURLAttribute,omitempty"`
ProfileAttribute string `json:"profileAttribute,omitempty"`
}
type IDPLDAP struct {
*IdentityProvider
LDAP
}
type Apple struct {
ClientID string `json:"clientId"`
TeamID string `json:"teamId"`
KeyID string `json:"keyId"`
PrivateKey *crypto.CryptoValue `json:"privateKey"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPApple struct {
*IdentityProvider
Apple
}
type SAML struct {
Metadata []byte `json:"metadata,omitempty"`
Key *crypto.CryptoValue `json:"key,omitempty"`
Certificate []byte `json:"certificate,omitempty"`
Binding string `json:"binding,omitempty"`
WithSignedRequest bool `json:"withSignedRequest,omitempty"`
NameIDFormat *domain.SAMLNameIDFormat `json:"nameIDFormat,omitempty"`
TransientMappingAttributeName string `json:"transientMappingAttributeName,omitempty"`
FederatedLogoutEnabled bool `json:"federatedLogoutEnabled,omitempty"`
SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"`
}
type IDPSAML struct {
*IdentityProvider
SAML
}
// IDPIdentifierCondition is used to help specify a single identity_provider,
// it will either be used as the identity_provider ID or identity_provider name,
// as identity_provider can be identified either using (instanceID + OrgID + ID) OR (instanceID + OrgID + name)
type IDPIdentifierCondition interface {
database.Condition
}
type idProviderColumns interface {
InstanceIDColumn() database.Column
OrgIDColumn() database.Column
IDColumn() database.Column
StateColumn() database.Column
NameColumn() database.Column
TypeColumn() database.Column
AllowCreationColumn() database.Column
AutoRegisterColumn() database.Column
AllowAutoCreationColumn() database.Column
AllowAutoUpdateColumn() database.Column
AllowLinkingColumn() database.Column
AllowAutoLinkingColumn() database.Column
StylingTypeColumn() database.Column
PayloadColumn() database.Column
CreatedAtColumn() database.Column
UpdatedAtColumn() database.Column
}
type idProviderConditions interface {
InstanceIDCondition(id string) database.Condition
OrgIDCondition(id *string) database.Condition
IDCondition(id string) IDPIdentifierCondition
StateCondition(state IDPState) database.Condition
NameCondition(name string) IDPIdentifierCondition
TypeCondition(typee IDPType) database.Condition
AutoRegisterCondition(allow bool) database.Condition
AllowCreationCondition(allow bool) database.Condition
AllowAutoCreationCondition(allow bool) database.Condition
AllowAutoUpdateCondition(allow bool) database.Condition
AllowLinkingCondition(allow bool) database.Condition
AllowAutoLinkingCondition(linkingType IDPAutoLinkingField) database.Condition
StylingTypeCondition(style int16) database.Condition
PayloadCondition(payload string) database.Condition
}
type idProviderChanges interface {
SetName(name string) database.Change
SetState(state IDPState) database.Change
SetAllowCreation(allow bool) database.Change
SetAutoRegister(allow bool) database.Change
SetAllowAutoCreation(allow bool) database.Change
SetAllowAutoUpdate(allow bool) database.Change
SetAllowLinking(allow bool) database.Change
SetAutoAllowLinking(allow bool) database.Change
SetStylingType(stylingType int16) database.Change
SetPayload(payload string) database.Change
SetUpdatedAt(createdAt *time.Time) database.Change
}
type IDProviderRepository interface {
idProviderColumns
idProviderConditions
idProviderChanges
Get(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IdentityProvider, error)
List(ctx context.Context, client database.QueryExecutor, conditions ...database.Condition) ([]*IdentityProvider, error)
Create(ctx context.Context, client database.QueryExecutor, idp *IdentityProvider) error
Update(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string, changes ...database.Change) (int64, error)
Delete(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (int64, error)
GetOIDC(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPOIDC, error)
GetJWT(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPJWT, error)
GetOAuth(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPOAuth, error)
GetAzureAD(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPAzureAD, error)
GetGoogle(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGoogle, error)
GetGithub(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGithub, error)
GetGithubEnterprise(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGithubEnterprise, error)
GetGitlab(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGitlab, error)
GetGitlabSelfHosting(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGitlabSelfHosting, error)
GetLDAP(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPLDAP, error)
GetApple(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPApple, error)
GetSAML(ctx context.Context, client database.QueryExecutor, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPSAML, error)
}
@@ -0,0 +1,79 @@
// Code generated by "enumer -type IDPAutoLinkingField -transform lower -trimprefix IDPAutoLinkingField"; DO NOT EDIT.
package domain
import (
"fmt"
"strings"
)
const _IDPAutoLinkingFieldName = "usernameemail"
var _IDPAutoLinkingFieldIndex = [...]uint8{0, 8, 13}
const _IDPAutoLinkingFieldLowerName = "usernameemail"
func (i IDPAutoLinkingField) String() string {
i -= 1
if i >= IDPAutoLinkingField(len(_IDPAutoLinkingFieldIndex)-1) {
return fmt.Sprintf("IDPAutoLinkingField(%d)", i+1)
}
return _IDPAutoLinkingFieldName[_IDPAutoLinkingFieldIndex[i]:_IDPAutoLinkingFieldIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _IDPAutoLinkingFieldNoOp() {
var x [1]struct{}
_ = x[IDPAutoLinkingFieldUserName-(1)]
_ = x[IDPAutoLinkingFieldEmail-(2)]
}
var _IDPAutoLinkingFieldValues = []IDPAutoLinkingField{IDPAutoLinkingFieldUserName, IDPAutoLinkingFieldEmail}
var _IDPAutoLinkingFieldNameToValueMap = map[string]IDPAutoLinkingField{
_IDPAutoLinkingFieldName[0:8]: IDPAutoLinkingFieldUserName,
_IDPAutoLinkingFieldLowerName[0:8]: IDPAutoLinkingFieldUserName,
_IDPAutoLinkingFieldName[8:13]: IDPAutoLinkingFieldEmail,
_IDPAutoLinkingFieldLowerName[8:13]: IDPAutoLinkingFieldEmail,
}
var _IDPAutoLinkingFieldNames = []string{
_IDPAutoLinkingFieldName[0:8],
_IDPAutoLinkingFieldName[8:13],
}
// IDPAutoLinkingFieldString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func IDPAutoLinkingFieldString(s string) (IDPAutoLinkingField, error) {
if val, ok := _IDPAutoLinkingFieldNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _IDPAutoLinkingFieldNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to IDPAutoLinkingField values", s)
}
// IDPAutoLinkingFieldValues returns all values of the enum
func IDPAutoLinkingFieldValues() []IDPAutoLinkingField {
return _IDPAutoLinkingFieldValues
}
// IDPAutoLinkingFieldStrings returns a slice of all String values of the enum
func IDPAutoLinkingFieldStrings() []string {
strs := make([]string, len(_IDPAutoLinkingFieldNames))
copy(strs, _IDPAutoLinkingFieldNames)
return strs
}
// IsAIDPAutoLinkingField returns "true" if the value is listed in the enum definition. "false" otherwise
func (i IDPAutoLinkingField) IsAIDPAutoLinkingField() bool {
for _, v := range _IDPAutoLinkingFieldValues {
if i == v {
return true
}
}
return false
}
+109
View File
@@ -0,0 +1,109 @@
// Code generated by "enumer -type IDPState -transform lower -trimprefix IDPState -sql"; DO NOT EDIT.
package domain
import (
"database/sql/driver"
"fmt"
"strings"
)
const _IDPStateName = "activeinactive"
var _IDPStateIndex = [...]uint8{0, 6, 14}
const _IDPStateLowerName = "activeinactive"
func (i IDPState) String() string {
if i >= IDPState(len(_IDPStateIndex)-1) {
return fmt.Sprintf("IDPState(%d)", i)
}
return _IDPStateName[_IDPStateIndex[i]:_IDPStateIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _IDPStateNoOp() {
var x [1]struct{}
_ = x[IDPStateActive-(0)]
_ = x[IDPStateInactive-(1)]
}
var _IDPStateValues = []IDPState{IDPStateActive, IDPStateInactive}
var _IDPStateNameToValueMap = map[string]IDPState{
_IDPStateName[0:6]: IDPStateActive,
_IDPStateLowerName[0:6]: IDPStateActive,
_IDPStateName[6:14]: IDPStateInactive,
_IDPStateLowerName[6:14]: IDPStateInactive,
}
var _IDPStateNames = []string{
_IDPStateName[0:6],
_IDPStateName[6:14],
}
// IDPStateString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func IDPStateString(s string) (IDPState, error) {
if val, ok := _IDPStateNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _IDPStateNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to IDPState values", s)
}
// IDPStateValues returns all values of the enum
func IDPStateValues() []IDPState {
return _IDPStateValues
}
// IDPStateStrings returns a slice of all String values of the enum
func IDPStateStrings() []string {
strs := make([]string, len(_IDPStateNames))
copy(strs, _IDPStateNames)
return strs
}
// IsAIDPState returns "true" if the value is listed in the enum definition. "false" otherwise
func (i IDPState) IsAIDPState() bool {
for _, v := range _IDPStateValues {
if i == v {
return true
}
}
return false
}
func (i IDPState) Value() (driver.Value, error) {
return i.String(), nil
}
func (i *IDPState) Scan(value interface{}) error {
if value == nil {
return nil
}
var str string
switch v := value.(type) {
case []byte:
str = string(v)
case string:
str = v
case fmt.Stringer:
str = v.String()
default:
return fmt.Errorf("invalid value of IDPState: %[1]T(%[1]v)", value)
}
val, err := IDPStateString(str)
if err != nil {
return err
}
*i = val
return nil
}
+119
View File
@@ -0,0 +1,119 @@
// Code generated by "enumer -type IDPType -transform lower -trimprefix IDPType"; DO NOT EDIT.
package domain
import (
"fmt"
"strings"
)
const _IDPTypeName = "oidcjwtoauthsamlldapgithubgithubenterprisegitlabgitlabselfhostedazuregoogleapple"
var _IDPTypeIndex = [...]uint8{0, 4, 7, 12, 16, 20, 26, 42, 48, 64, 69, 75, 80}
const _IDPTypeLowerName = "oidcjwtoauthsamlldapgithubgithubenterprisegitlabgitlabselfhostedazuregoogleapple"
func (i IDPType) String() string {
i -= 1
if i >= IDPType(len(_IDPTypeIndex)-1) {
return fmt.Sprintf("IDPType(%d)", i+1)
}
return _IDPTypeName[_IDPTypeIndex[i]:_IDPTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _IDPTypeNoOp() {
var x [1]struct{}
_ = x[IDPTypeOIDC-(1)]
_ = x[IDPTypeJWT-(2)]
_ = x[IDPTypeOAuth-(3)]
_ = x[IDPTypeSAML-(4)]
_ = x[IDPTypeLDAP-(5)]
_ = x[IDPTypeGitHub-(6)]
_ = x[IDPTypeGitHubEnterprise-(7)]
_ = x[IDPTypeGitLab-(8)]
_ = x[IDPTypeGitLabSelfHosted-(9)]
_ = x[IDPTypeAzure-(10)]
_ = x[IDPTypeGoogle-(11)]
_ = x[IDPTypeApple-(12)]
}
var _IDPTypeValues = []IDPType{IDPTypeOIDC, IDPTypeJWT, IDPTypeOAuth, IDPTypeSAML, IDPTypeLDAP, IDPTypeGitHub, IDPTypeGitHubEnterprise, IDPTypeGitLab, IDPTypeGitLabSelfHosted, IDPTypeAzure, IDPTypeGoogle, IDPTypeApple}
var _IDPTypeNameToValueMap = map[string]IDPType{
_IDPTypeName[0:4]: IDPTypeOIDC,
_IDPTypeLowerName[0:4]: IDPTypeOIDC,
_IDPTypeName[4:7]: IDPTypeJWT,
_IDPTypeLowerName[4:7]: IDPTypeJWT,
_IDPTypeName[7:12]: IDPTypeOAuth,
_IDPTypeLowerName[7:12]: IDPTypeOAuth,
_IDPTypeName[12:16]: IDPTypeSAML,
_IDPTypeLowerName[12:16]: IDPTypeSAML,
_IDPTypeName[16:20]: IDPTypeLDAP,
_IDPTypeLowerName[16:20]: IDPTypeLDAP,
_IDPTypeName[20:26]: IDPTypeGitHub,
_IDPTypeLowerName[20:26]: IDPTypeGitHub,
_IDPTypeName[26:42]: IDPTypeGitHubEnterprise,
_IDPTypeLowerName[26:42]: IDPTypeGitHubEnterprise,
_IDPTypeName[42:48]: IDPTypeGitLab,
_IDPTypeLowerName[42:48]: IDPTypeGitLab,
_IDPTypeName[48:64]: IDPTypeGitLabSelfHosted,
_IDPTypeLowerName[48:64]: IDPTypeGitLabSelfHosted,
_IDPTypeName[64:69]: IDPTypeAzure,
_IDPTypeLowerName[64:69]: IDPTypeAzure,
_IDPTypeName[69:75]: IDPTypeGoogle,
_IDPTypeLowerName[69:75]: IDPTypeGoogle,
_IDPTypeName[75:80]: IDPTypeApple,
_IDPTypeLowerName[75:80]: IDPTypeApple,
}
var _IDPTypeNames = []string{
_IDPTypeName[0:4],
_IDPTypeName[4:7],
_IDPTypeName[7:12],
_IDPTypeName[12:16],
_IDPTypeName[16:20],
_IDPTypeName[20:26],
_IDPTypeName[26:42],
_IDPTypeName[42:48],
_IDPTypeName[48:64],
_IDPTypeName[64:69],
_IDPTypeName[69:75],
_IDPTypeName[75:80],
}
// IDPTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func IDPTypeString(s string) (IDPType, error) {
if val, ok := _IDPTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _IDPTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to IDPType values", s)
}
// IDPTypeValues returns all values of the enum
func IDPTypeValues() []IDPType {
return _IDPTypeValues
}
// IDPTypeStrings returns a slice of all String values of the enum
func IDPTypeStrings() []string {
strs := make([]string, len(_IDPTypeNames))
copy(strs, _IDPTypeNames)
return strs
}
// IsAIDPType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i IDPType) IsAIDPType() bool {
for _, v := range _IDPTypeValues {
if i == v {
return true
}
}
return false
}
+1 -1
View File
@@ -32,7 +32,7 @@ type organizationColumns interface {
IDColumn() database.Column
// NameColumn returns the column for the name field.
NameColumn() database.Column
// InstanceIDColumn returns the column for the default org id field
// InstanceIDColumn returns the column for the instance id field
InstanceIDColumn() database.Column
// StateColumn returns the column for the name field.
StateColumn() database.Column