transformation

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: BSD-3-Clause-Clear Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderTypeSQL    = "sql"
	ProviderTypeLDAP   = "ldap"
	ProviderTypeClaims = "claims"
)

Provider type constants

View Source
const (
	// Basic data type transformations
	CommonArray     = "array"
	CommonString    = "string"
	CommonLowercase = "lowercase"
	CommonUppercase = "uppercase"

	// Common parsing transformations
	CommonCSVToArray = "csv_to_array"
)

Common transformation constants - usable by all providers

View Source
const (
	LDAPDNToCNArray = "ldap_dn_to_cn_array"
	LDAPDNToCN      = "ldap_dn_to_cn"
	LDAPAttrValues  = "ldap_attribute_values"
	LDAPADGroupName = "ad_group_name"
)

LDAP-specific transformation constants

View Source
const (
	ClaimsExtractScope    = "jwt_extract_scope"
	ClaimsNormalizeGroups = "jwt_normalize_groups"
)

Claims-specific transformation constants

View Source
const (
	SQLPostgresArray = "postgres_array"
)

SQL-specific transformation constants

Variables

View Source
var DefaultRegistry = NewRegistry()

Global registry instance for convenience

Functions

func ApplyADGroupName

func ApplyADGroupName(value interface{}) (interface{}, error)

ApplyADGroupName extracts group name from Active Directory group DN

func ApplyArray

func ApplyArray(value interface{}) (interface{}, error)

ApplyArray ensures the value is returned as an array type

func ApplyCSVToArray

func ApplyCSVToArray(value interface{}) (interface{}, error)

ApplyCSVToArray converts comma-separated strings to string arrays

func ApplyClaimsTransformation

func ApplyClaimsTransformation(value interface{}, transformation string) (interface{}, error)

ApplyClaimsTransformation applies Claims-specific transformations

func ApplyCommonTransformation

func ApplyCommonTransformation(value interface{}, transformation string) (interface{}, error)

ApplyCommonTransformation applies common transformations that work across all providers

func ApplyJWTExtractScope

func ApplyJWTExtractScope(value interface{}) (interface{}, error)

ApplyJWTExtractScope extracts scopes from space-separated scope claim OAuth2/OIDC scopes are typically space-separated per RFC 6749

func ApplyJWTNormalizeGroups

func ApplyJWTNormalizeGroups(value interface{}) (interface{}, error)

ApplyJWTNormalizeGroups normalizes group names from various formats Handles comma-separated, space-separated, or array formats

func ApplyLDAPAttributeValues

func ApplyLDAPAttributeValues(value interface{}) (interface{}, error)

ApplyLDAPAttributeValues extracts values from LDAP attribute (handle multi-valued attributes)

func ApplyLDAPDNToCN

func ApplyLDAPDNToCN(value interface{}) (interface{}, error)

ApplyLDAPDNToCN converts single DN to CN

func ApplyLDAPDNToCNArray

func ApplyLDAPDNToCNArray(value interface{}) (interface{}, error)

ApplyLDAPDNToCNArray converts array of DNs to array of CNs

func ApplyLDAPTransformation

func ApplyLDAPTransformation(value interface{}, transformation string) (interface{}, error)

ApplyLDAPTransformation applies LDAP-specific transformations

func ApplyLowercase

func ApplyLowercase(value interface{}) (interface{}, error)

ApplyLowercase converts string values to lowercase

func ApplyPostgresArray

func ApplyPostgresArray(value interface{}) (interface{}, error)

ApplyPostgresArray handles PostgreSQL array format: {item1,item2,item3}

func ApplySQLTransformation

func ApplySQLTransformation(value interface{}, transformation string) (interface{}, error)

ApplySQLTransformation applies SQL-specific transformations

func ApplyString

func ApplyString(value interface{}) (interface{}, error)

ApplyString converts any value to its string representation

func ApplyUppercase

func ApplyUppercase(value interface{}) (interface{}, error)

ApplyUppercase converts string values to uppercase

func EscapeLDAPFilter

func EscapeLDAPFilter(value string) string

EscapeLDAPFilter escapes special characters in LDAP filter values This is a utility function for LDAP providers

func ExtractCNFromDN

func ExtractCNFromDN(dn string) string

ExtractCNFromDN extracts the Common Name (CN) from a Distinguished Name (DN) Example: "CN=Users,OU=Groups,DC=example,DC=com" -> "Users"

func GetAllClaimsTransformations

func GetAllClaimsTransformations() []string

GetAllClaimsTransformations returns common + Claims transformations

func GetAllLDAPTransformations

func GetAllLDAPTransformations() []string

GetAllLDAPTransformations returns common + LDAP transformations

func GetAllSQLTransformations

func GetAllSQLTransformations() []string

GetAllSQLTransformations returns common + SQL transformations

func GetClaimsTransformations

func GetClaimsTransformations() []string

GetClaimsTransformations returns Claims-specific transformations

func GetCommonTransformations

func GetCommonTransformations() []string

GetCommonTransformations returns all common transformations available to any provider

func GetLDAPTransformations

func GetLDAPTransformations() []string

GetLDAPTransformations returns LDAP-specific transformations

func GetSQLTransformations

func GetSQLTransformations() []string

GetSQLTransformations returns SQL-specific transformations

func IsCommonTransformation

func IsCommonTransformation(transformation string) bool

IsCommonTransformation checks if a transformation is a common one

func IsSupportedByProvider

func IsSupportedByProvider(transformation, providerType string) bool

IsSupportedByProvider checks if a transformation is supported by a specific provider type

Types

type Registry

type Registry struct{}

Registry provides a unified interface for applying transformations across all provider types with fallback to common transformations

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new transformation registry

func (*Registry) ApplyTransformation

func (r *Registry) ApplyTransformation(value interface{}, transformation string, providerType string) (interface{}, error)

ApplyTransformation applies a transformation with provider-aware fallback

func (*Registry) GetSupportedTransformations

func (r *Registry) GetSupportedTransformations(providerType string) []string

GetSupportedTransformations returns all transformations supported by a provider type

func (*Registry) ValidateTransformation

func (r *Registry) ValidateTransformation(transformation string, providerType string) error

ValidateTransformation checks if a transformation is supported by a provider type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL