package sharedmodel import ( "gorm.io/gorm" "whiteboxsystems.nl/openkvpoc/openkv" ) type RegistrationStatus string const ( RegistrationStatusPending = RegistrationStatus("pending") RegistrationStatusCompleted = RegistrationStatus("completed") ) type Registration struct { gorm.Model OrganisationId string OrganisationIdSystem string OrganisationDisplayName string AuthConfigID uint AuthConfig *AuthConfig Reference string PSK string Status RegistrationStatus } func (r *Registration) SetAuthConfig(cfg *openkv.AuthConfig) { authConfig := &AuthConfig{ Method: cfg.Method, } switch cfg.Method { case openkv.AuthMethod_JWT: authConfig.Raw = cfg.GetJwtConfig().GetPublicKey() case openkv.AuthMethod_APIToken: authConfig.Raw = cfg.GetApiTokenConfig().GetToken() case openkv.AuthMethod_mTLS: authConfig.Raw = cfg.GetMtlsConfig().GetPublicKey() } r.AuthConfig = authConfig }