2024-02-28 10:55:54 +02:00
|
|
|
package feature
|
|
|
|
|
2024-12-19 10:37:46 +01:00
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
"slices"
|
|
|
|
)
|
2024-07-05 10:36:00 +03:00
|
|
|
|
2024-02-28 10:55:54 +02:00
|
|
|
//go:generate enumer -type Key -transform snake -trimprefix Key
|
|
|
|
type Key int
|
|
|
|
|
|
|
|
const (
|
2025-06-30 08:48:04 +03:00
|
|
|
// Reserved: 2, 3, 6, 8
|
2025-06-26 11:08:37 +03:00
|
|
|
|
2025-06-30 08:48:04 +03:00
|
|
|
KeyUnspecified Key = 0
|
|
|
|
KeyLoginDefaultOrg Key = 1
|
|
|
|
KeyUserSchema Key = 4
|
|
|
|
KeyTokenExchange Key = 5
|
|
|
|
KeyImprovedPerformance Key = 7
|
|
|
|
KeyDebugOIDCParentError Key = 9
|
|
|
|
KeyOIDCSingleV1SessionTermination Key = 10
|
|
|
|
KeyDisableUserTokenEvent Key = 11
|
|
|
|
KeyEnableBackChannelLogout Key = 12
|
|
|
|
KeyLoginV2 Key = 13
|
|
|
|
KeyPermissionCheckV2 Key = 14
|
|
|
|
KeyConsoleUseV2UserApi Key = 15
|
2024-02-28 10:55:54 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
//go:generate enumer -type Level -transform snake -trimprefix Level
|
|
|
|
type Level int
|
|
|
|
|
|
|
|
const (
|
|
|
|
LevelUnspecified Level = iota
|
|
|
|
LevelSystem
|
|
|
|
LevelInstance
|
|
|
|
LevelOrg
|
|
|
|
LevelProject
|
|
|
|
LevelApp
|
|
|
|
LevelUser
|
|
|
|
)
|
|
|
|
|
|
|
|
type Features struct {
|
2025-06-30 08:48:04 +03:00
|
|
|
LoginDefaultOrg bool `json:"login_default_org,omitempty"`
|
|
|
|
UserSchema bool `json:"user_schema,omitempty"`
|
|
|
|
TokenExchange bool `json:"token_exchange,omitempty"`
|
|
|
|
ImprovedPerformance []ImprovedPerformanceType `json:"improved_performance,omitempty"`
|
|
|
|
DebugOIDCParentError bool `json:"debug_oidc_parent_error,omitempty"`
|
|
|
|
OIDCSingleV1SessionTermination bool `json:"oidc_single_v1_session_termination,omitempty"`
|
|
|
|
DisableUserTokenEvent bool `json:"disable_user_token_event,omitempty"`
|
|
|
|
EnableBackChannelLogout bool `json:"enable_back_channel_logout,omitempty"`
|
|
|
|
LoginV2 LoginV2 `json:"login_v2,omitempty"`
|
|
|
|
PermissionCheckV2 bool `json:"permission_check_v2,omitempty"`
|
|
|
|
ConsoleUseV2UserApi bool `json:"console_use_v2_user_api,omitempty"`
|
2024-05-24 13:32:57 +02:00
|
|
|
}
|
|
|
|
|
2025-04-30 10:26:04 +02:00
|
|
|
/* Note: do not generate the stringer or enumer for this type, is it breaks existing events */
|
|
|
|
|
2024-05-24 13:32:57 +02:00
|
|
|
type ImprovedPerformanceType int32
|
|
|
|
|
|
|
|
const (
|
2025-04-29 16:54:53 +02:00
|
|
|
ImprovedPerformanceTypeUnspecified ImprovedPerformanceType = iota
|
2024-05-24 13:32:57 +02:00
|
|
|
ImprovedPerformanceTypeOrgByID
|
2024-07-03 17:00:56 +02:00
|
|
|
ImprovedPerformanceTypeProjectGrant
|
|
|
|
ImprovedPerformanceTypeProject
|
2024-07-04 19:18:43 +03:00
|
|
|
ImprovedPerformanceTypeUserGrant
|
2024-07-05 10:36:00 +03:00
|
|
|
ImprovedPerformanceTypeOrgDomainVerified
|
2024-05-24 13:32:57 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func (f Features) ShouldUseImprovedPerformance(typ ImprovedPerformanceType) bool {
|
2024-07-05 10:36:00 +03:00
|
|
|
return slices.Contains(f.ImprovedPerformance, typ)
|
2024-02-28 10:55:54 +02:00
|
|
|
}
|
2024-12-19 10:37:46 +01:00
|
|
|
|
|
|
|
type LoginV2 struct {
|
|
|
|
Required bool `json:"required,omitempty"`
|
|
|
|
BaseURI *url.URL `json:"base_uri,omitempty"`
|
|
|
|
}
|