fixup! fixup! fixup! fixup! fixup! fixup! added first event

This commit is contained in:
Iraq Jaber
2025-07-30 12:15:56 +01:00
parent ae65867849
commit 5ed2f54398
7 changed files with 465 additions and 138 deletions

View File

@@ -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
}

View File

@@ -17,7 +17,7 @@ const (
IDPTypeJWT
IDPTypeOAuth
IDPTypeLDAP
IDPTypeAzureAD
IDPTypeAzure
IDPTypeGitHub
IDPTypeGitHubEnterprise
IDPTypeGitLab
@@ -123,6 +123,43 @@ type IDPOAuth struct {
OAuth
}
//go:generate enumer -type AzureTenantType -transform lower -trimprefix AzureTenantType
type AzureTenantType uint8
const (
AzureTenantTypeCommon AzureTenantType = iota
AzureTenantTypeOrganizations
AzureTenantTypeConsumers
)
type Azure struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ClientID string `json:"client_id,omitempty"`
ClientSecret *crypto.CryptoValue `json:"client_secret,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Tenant string `json:"tenant,omitempty"`
IsEmailVerified bool `json:"isEmailVerified,omitempty"`
}
type IDPOAzureAD struct {
*IdentityProvider
Azure
}
type Google struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
ClientID string `json:"clientId"`
ClientSecret *crypto.CryptoValue `json:"clientSecret"`
Scopes []string `json:"scopes,omitempty"`
}
type IDPGoogle struct {
*IdentityProvider
Google
}
// 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)
@@ -195,4 +232,7 @@ type IDProviderRepository interface {
GetJWT(ctx context.Context, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPJWT, error)
GetOAuth(ctx context.Context, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPOAuth, error)
GetOAzureAD(ctx context.Context, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPOAzureAD, error)
GetGoogle(ctx context.Context, id IDPIdentifierCondition, instanceID string, orgID *string) (*IDPGoogle, error)
}

View File

@@ -7,11 +7,11 @@ import (
"strings"
)
const _IDPTypeName = "unspecifiedoidcjwtoauthldapazureadgithubgithubenterprisegitlabgitlabselfhostedgoogleapplesaml"
const _IDPTypeName = "unspecifiedoidcjwtoauthldapazuregithubgithubenterprisegitlabgitlabselfhostedgoogleapplesaml"
var _IDPTypeIndex = [...]uint8{0, 11, 15, 18, 23, 27, 34, 40, 56, 62, 78, 84, 89, 93}
var _IDPTypeIndex = [...]uint8{0, 11, 15, 18, 23, 27, 32, 38, 54, 60, 76, 82, 87, 91}
const _IDPTypeLowerName = "unspecifiedoidcjwtoauthldapazureadgithubgithubenterprisegitlabgitlabselfhostedgoogleapplesaml"
const _IDPTypeLowerName = "unspecifiedoidcjwtoauthldapazuregithubgithubenterprisegitlabgitlabselfhostedgoogleapplesaml"
func (i IDPType) String() string {
if i >= IDPType(len(_IDPTypeIndex)-1) {
@@ -29,7 +29,7 @@ func _IDPTypeNoOp() {
_ = x[IDPTypeJWT-(2)]
_ = x[IDPTypeOAuth-(3)]
_ = x[IDPTypeLDAP-(4)]
_ = x[IDPTypeAzureAD-(5)]
_ = x[IDPTypeAzure-(5)]
_ = x[IDPTypeGitHub-(6)]
_ = x[IDPTypeGitHubEnterprise-(7)]
_ = x[IDPTypeGitLab-(8)]
@@ -39,7 +39,7 @@ func _IDPTypeNoOp() {
_ = x[IDPTypeSAML-(12)]
}
var _IDPTypeValues = []IDPType{IDPTypeUnspecified, IDPTypeOIDC, IDPTypeJWT, IDPTypeOAuth, IDPTypeLDAP, IDPTypeAzureAD, IDPTypeGitHub, IDPTypeGitHubEnterprise, IDPTypeGitLab, IDPTypeGitLabSelfHosted, IDPTypeGoogle, IDPTypeApple, IDPTypeSAML}
var _IDPTypeValues = []IDPType{IDPTypeUnspecified, IDPTypeOIDC, IDPTypeJWT, IDPTypeOAuth, IDPTypeLDAP, IDPTypeAzure, IDPTypeGitHub, IDPTypeGitHubEnterprise, IDPTypeGitLab, IDPTypeGitLabSelfHosted, IDPTypeGoogle, IDPTypeApple, IDPTypeSAML}
var _IDPTypeNameToValueMap = map[string]IDPType{
_IDPTypeName[0:11]: IDPTypeUnspecified,
@@ -52,22 +52,22 @@ var _IDPTypeNameToValueMap = map[string]IDPType{
_IDPTypeLowerName[18:23]: IDPTypeOAuth,
_IDPTypeName[23:27]: IDPTypeLDAP,
_IDPTypeLowerName[23:27]: IDPTypeLDAP,
_IDPTypeName[27:34]: IDPTypeAzureAD,
_IDPTypeLowerName[27:34]: IDPTypeAzureAD,
_IDPTypeName[34:40]: IDPTypeGitHub,
_IDPTypeLowerName[34:40]: IDPTypeGitHub,
_IDPTypeName[40:56]: IDPTypeGitHubEnterprise,
_IDPTypeLowerName[40:56]: IDPTypeGitHubEnterprise,
_IDPTypeName[56:62]: IDPTypeGitLab,
_IDPTypeLowerName[56:62]: IDPTypeGitLab,
_IDPTypeName[62:78]: IDPTypeGitLabSelfHosted,
_IDPTypeLowerName[62:78]: IDPTypeGitLabSelfHosted,
_IDPTypeName[78:84]: IDPTypeGoogle,
_IDPTypeLowerName[78:84]: IDPTypeGoogle,
_IDPTypeName[84:89]: IDPTypeApple,
_IDPTypeLowerName[84:89]: IDPTypeApple,
_IDPTypeName[89:93]: IDPTypeSAML,
_IDPTypeLowerName[89:93]: IDPTypeSAML,
_IDPTypeName[27:32]: IDPTypeAzure,
_IDPTypeLowerName[27:32]: IDPTypeAzure,
_IDPTypeName[32:38]: IDPTypeGitHub,
_IDPTypeLowerName[32:38]: IDPTypeGitHub,
_IDPTypeName[38:54]: IDPTypeGitHubEnterprise,
_IDPTypeLowerName[38:54]: IDPTypeGitHubEnterprise,
_IDPTypeName[54:60]: IDPTypeGitLab,
_IDPTypeLowerName[54:60]: IDPTypeGitLab,
_IDPTypeName[60:76]: IDPTypeGitLabSelfHosted,
_IDPTypeLowerName[60:76]: IDPTypeGitLabSelfHosted,
_IDPTypeName[76:82]: IDPTypeGoogle,
_IDPTypeLowerName[76:82]: IDPTypeGoogle,
_IDPTypeName[82:87]: IDPTypeApple,
_IDPTypeLowerName[82:87]: IDPTypeApple,
_IDPTypeName[87:91]: IDPTypeSAML,
_IDPTypeLowerName[87:91]: IDPTypeSAML,
}
var _IDPTypeNames = []string{
@@ -76,14 +76,14 @@ var _IDPTypeNames = []string{
_IDPTypeName[15:18],
_IDPTypeName[18:23],
_IDPTypeName[23:27],
_IDPTypeName[27:34],
_IDPTypeName[34:40],
_IDPTypeName[40:56],
_IDPTypeName[56:62],
_IDPTypeName[62:78],
_IDPTypeName[78:84],
_IDPTypeName[84:89],
_IDPTypeName[89:93],
_IDPTypeName[27:32],
_IDPTypeName[32:38],
_IDPTypeName[38:54],
_IDPTypeName[54:60],
_IDPTypeName[60:76],
_IDPTypeName[76:82],
_IDPTypeName[82:87],
_IDPTypeName[87:91],
}
// IDPTypeString retrieves an enum value from the enum constants string name.