diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 35446f5e27..e963f94568 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -48,7 +48,12 @@ class ApplicationSerializer(ModelSerializer): """Application Serializer""" launch_url = SerializerMethodField() - provider_obj = ProviderSerializer(source="get_provider", required=False, read_only=True) + provider_obj = ProviderSerializer( + source="get_provider", + required=False, + read_only=True, + allow_null=True, + ) backchannel_providers_obj = ProviderSerializer( source="backchannel_providers", required=False, read_only=True, many=True ) diff --git a/authentik/endpoints/connectors/agent/api/enrollment_tokens.py b/authentik/endpoints/connectors/agent/api/enrollment_tokens.py index 7adccb6c1e..4f04d942d7 100644 --- a/authentik/endpoints/connectors/agent/api/enrollment_tokens.py +++ b/authentik/endpoints/connectors/agent/api/enrollment_tokens.py @@ -18,7 +18,10 @@ from authentik.rbac.decorators import permission_required class EnrollmentTokenSerializer(ModelSerializer): device_group_obj = DeviceAccessGroupSerializer( - source="device_group", read_only=True, required=False + source="device_group", + read_only=True, + required=False, + allow_null=True, ) def __init__(self, *args, **kwargs) -> None: diff --git a/authentik/providers/saml/api/providers.py b/authentik/providers/saml/api/providers.py index 0fbc987570..6c3ed9181d 100644 --- a/authentik/providers/saml/api/providers.py +++ b/authentik/providers/saml/api/providers.py @@ -233,7 +233,7 @@ class SAMLMetadataSerializer(PassiveSerializer): """SAML Provider Metadata serializer""" metadata = CharField(read_only=True) - download_url = CharField(read_only=True, required=False) + download_url = CharField(read_only=True, required=False, allow_null=True) class SAMLProviderImportSerializer(PassiveSerializer): diff --git a/packages/client-go/model_application.go b/packages/client-go/model_application.go index 2ebd97b7c1..1e85684608 100644 --- a/packages/client-go/model_application.go +++ b/packages/client-go/model_application.go @@ -25,11 +25,11 @@ type Application struct { // Application's display Name. Name string `json:"name"` // Internal application name, used in URLs. - Slug string `json:"slug" validate:"regexp=^[-a-zA-Z0-9_]+$"` - Provider NullableInt32 `json:"provider,omitempty"` - ProviderObj Provider `json:"provider_obj"` - BackchannelProviders []int32 `json:"backchannel_providers,omitempty"` - BackchannelProvidersObj []Provider `json:"backchannel_providers_obj"` + Slug string `json:"slug" validate:"regexp=^[-a-zA-Z0-9_]+$"` + Provider NullableInt32 `json:"provider,omitempty"` + ProviderObj NullableProvider `json:"provider_obj"` + BackchannelProviders []int32 `json:"backchannel_providers,omitempty"` + BackchannelProvidersObj []Provider `json:"backchannel_providers_obj"` // Allow formatting of launch URL LaunchUrl NullableString `json:"launch_url"` // Open launch URL in a new browser tab or window. @@ -52,7 +52,7 @@ type _Application Application // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewApplication(pk string, name string, slug string, providerObj Provider, backchannelProvidersObj []Provider, launchUrl NullableString, metaIconUrl NullableString, metaIconThemedUrls NullableThemedUrls) *Application { +func NewApplication(pk string, name string, slug string, providerObj NullableProvider, backchannelProvidersObj []Provider, launchUrl NullableString, metaIconUrl NullableString, metaIconThemedUrls NullableThemedUrls) *Application { this := Application{} this.Pk = pk this.Name = name @@ -189,27 +189,29 @@ func (o *Application) UnsetProvider() { } // GetProviderObj returns the ProviderObj field value +// If the value is explicit nil, the zero value for Provider will be returned func (o *Application) GetProviderObj() Provider { - if o == nil { + if o == nil || o.ProviderObj.Get() == nil { var ret Provider return ret } - return o.ProviderObj + return *o.ProviderObj.Get() } // GetProviderObjOk returns a tuple with the ProviderObj field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Application) GetProviderObjOk() (*Provider, bool) { if o == nil { return nil, false } - return &o.ProviderObj, true + return o.ProviderObj.Get(), o.ProviderObj.IsSet() } // SetProviderObj sets field value func (o *Application) SetProviderObj(v Provider) { - o.ProviderObj = v + o.ProviderObj.Set(&v) } // GetBackchannelProviders returns the BackchannelProviders field value if set, zero value otherwise. @@ -586,7 +588,7 @@ func (o Application) ToMap() (map[string]interface{}, error) { if o.Provider.IsSet() { toSerialize["provider"] = o.Provider.Get() } - toSerialize["provider_obj"] = o.ProviderObj + toSerialize["provider_obj"] = o.ProviderObj.Get() if !IsNil(o.BackchannelProviders) { toSerialize["backchannel_providers"] = o.BackchannelProviders } diff --git a/packages/client-go/model_enrollment_token.go b/packages/client-go/model_enrollment_token.go index 7b5fcc4c75..377f75eb52 100644 --- a/packages/client-go/model_enrollment_token.go +++ b/packages/client-go/model_enrollment_token.go @@ -22,13 +22,13 @@ var _ MappedNullable = &EnrollmentToken{} // EnrollmentToken struct for EnrollmentToken type EnrollmentToken struct { - TokenUuid string `json:"token_uuid"` - DeviceGroup NullableString `json:"device_group,omitempty"` - DeviceGroupObj DeviceAccessGroup `json:"device_group_obj"` - Connector string `json:"connector"` - Name string `json:"name"` - Expiring *bool `json:"expiring,omitempty"` - Expires NullableTime `json:"expires,omitempty"` + TokenUuid string `json:"token_uuid"` + DeviceGroup NullableString `json:"device_group,omitempty"` + DeviceGroupObj NullableDeviceAccessGroup `json:"device_group_obj"` + Connector string `json:"connector"` + Name string `json:"name"` + Expiring *bool `json:"expiring,omitempty"` + Expires NullableTime `json:"expires,omitempty"` AdditionalProperties map[string]interface{} } @@ -38,7 +38,7 @@ type _EnrollmentToken EnrollmentToken // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewEnrollmentToken(tokenUuid string, deviceGroupObj DeviceAccessGroup, connector string, name string) *EnrollmentToken { +func NewEnrollmentToken(tokenUuid string, deviceGroupObj NullableDeviceAccessGroup, connector string, name string) *EnrollmentToken { this := EnrollmentToken{} this.TokenUuid = tokenUuid this.DeviceGroupObj = deviceGroupObj @@ -123,27 +123,29 @@ func (o *EnrollmentToken) UnsetDeviceGroup() { } // GetDeviceGroupObj returns the DeviceGroupObj field value +// If the value is explicit nil, the zero value for DeviceAccessGroup will be returned func (o *EnrollmentToken) GetDeviceGroupObj() DeviceAccessGroup { - if o == nil { + if o == nil || o.DeviceGroupObj.Get() == nil { var ret DeviceAccessGroup return ret } - return o.DeviceGroupObj + return *o.DeviceGroupObj.Get() } // GetDeviceGroupObjOk returns a tuple with the DeviceGroupObj field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *EnrollmentToken) GetDeviceGroupObjOk() (*DeviceAccessGroup, bool) { if o == nil { return nil, false } - return &o.DeviceGroupObj, true + return o.DeviceGroupObj.Get(), o.DeviceGroupObj.IsSet() } // SetDeviceGroupObj sets field value func (o *EnrollmentToken) SetDeviceGroupObj(v DeviceAccessGroup) { - o.DeviceGroupObj = v + o.DeviceGroupObj.Set(&v) } // GetConnector returns the Connector field value @@ -283,7 +285,7 @@ func (o EnrollmentToken) ToMap() (map[string]interface{}, error) { if o.DeviceGroup.IsSet() { toSerialize["device_group"] = o.DeviceGroup.Get() } - toSerialize["device_group_obj"] = o.DeviceGroupObj + toSerialize["device_group_obj"] = o.DeviceGroupObj.Get() toSerialize["connector"] = o.Connector toSerialize["name"] = o.Name if !IsNil(o.Expiring) { diff --git a/packages/client-go/model_saml_metadata.go b/packages/client-go/model_saml_metadata.go index bb20b471dd..77a26b67ca 100644 --- a/packages/client-go/model_saml_metadata.go +++ b/packages/client-go/model_saml_metadata.go @@ -21,8 +21,8 @@ var _ MappedNullable = &SAMLMetadata{} // SAMLMetadata SAML Provider Metadata serializer type SAMLMetadata struct { - Metadata string `json:"metadata"` - DownloadUrl string `json:"download_url"` + Metadata string `json:"metadata"` + DownloadUrl NullableString `json:"download_url"` AdditionalProperties map[string]interface{} } @@ -32,7 +32,7 @@ type _SAMLMetadata SAMLMetadata // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSAMLMetadata(metadata string, downloadUrl string) *SAMLMetadata { +func NewSAMLMetadata(metadata string, downloadUrl NullableString) *SAMLMetadata { this := SAMLMetadata{} this.Metadata = metadata this.DownloadUrl = downloadUrl @@ -72,27 +72,29 @@ func (o *SAMLMetadata) SetMetadata(v string) { } // GetDownloadUrl returns the DownloadUrl field value +// If the value is explicit nil, the zero value for string will be returned func (o *SAMLMetadata) GetDownloadUrl() string { - if o == nil { + if o == nil || o.DownloadUrl.Get() == nil { var ret string return ret } - return o.DownloadUrl + return *o.DownloadUrl.Get() } // GetDownloadUrlOk returns a tuple with the DownloadUrl field value // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *SAMLMetadata) GetDownloadUrlOk() (*string, bool) { if o == nil { return nil, false } - return &o.DownloadUrl, true + return o.DownloadUrl.Get(), o.DownloadUrl.IsSet() } // SetDownloadUrl sets field value func (o *SAMLMetadata) SetDownloadUrl(v string) { - o.DownloadUrl = v + o.DownloadUrl.Set(&v) } func (o SAMLMetadata) MarshalJSON() ([]byte, error) { @@ -106,7 +108,7 @@ func (o SAMLMetadata) MarshalJSON() ([]byte, error) { func (o SAMLMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["metadata"] = o.Metadata - toSerialize["download_url"] = o.DownloadUrl + toSerialize["download_url"] = o.DownloadUrl.Get() for key, value := range o.AdditionalProperties { toSerialize[key] = value diff --git a/packages/client-rust/src/models/application.rs b/packages/client-rust/src/models/application.rs index 3be708ba94..6fc097a513 100644 --- a/packages/client-rust/src/models/application.rs +++ b/packages/client-rust/src/models/application.rs @@ -28,8 +28,8 @@ pub struct Application { skip_serializing_if = "Option::is_none" )] pub provider: Option>, - #[serde(rename = "provider_obj")] - pub provider_obj: models::Provider, + #[serde(rename = "provider_obj", deserialize_with = "Option::deserialize")] + pub provider_obj: Option, #[serde( rename = "backchannel_providers", skip_serializing_if = "Option::is_none" @@ -71,7 +71,7 @@ impl Application { pk: uuid::Uuid, name: String, slug: String, - provider_obj: models::Provider, + provider_obj: Option, backchannel_providers_obj: Vec, launch_url: Option, meta_icon_url: Option, diff --git a/packages/client-rust/src/models/enrollment_token.rs b/packages/client-rust/src/models/enrollment_token.rs index fbb9c79f8e..73f994e996 100644 --- a/packages/client-rust/src/models/enrollment_token.rs +++ b/packages/client-rust/src/models/enrollment_token.rs @@ -21,8 +21,8 @@ pub struct EnrollmentToken { skip_serializing_if = "Option::is_none" )] pub device_group: Option>, - #[serde(rename = "device_group_obj")] - pub device_group_obj: models::DeviceAccessGroup, + #[serde(rename = "device_group_obj", deserialize_with = "Option::deserialize")] + pub device_group_obj: Option, #[serde(rename = "connector")] pub connector: uuid::Uuid, #[serde(rename = "name")] @@ -41,7 +41,7 @@ pub struct EnrollmentToken { impl EnrollmentToken { pub fn new( token_uuid: uuid::Uuid, - device_group_obj: models::DeviceAccessGroup, + device_group_obj: Option, connector: uuid::Uuid, name: String, ) -> EnrollmentToken { diff --git a/packages/client-rust/src/models/saml_metadata.rs b/packages/client-rust/src/models/saml_metadata.rs index 9b7ffa0b74..4e53d3f9d4 100644 --- a/packages/client-rust/src/models/saml_metadata.rs +++ b/packages/client-rust/src/models/saml_metadata.rs @@ -15,13 +15,13 @@ use crate::models; pub struct SamlMetadata { #[serde(rename = "metadata")] pub metadata: String, - #[serde(rename = "download_url")] - pub download_url: String, + #[serde(rename = "download_url", deserialize_with = "Option::deserialize")] + pub download_url: Option, } impl SamlMetadata { /// SAML Provider Metadata serializer - pub fn new(metadata: String, download_url: String) -> SamlMetadata { + pub fn new(metadata: String, download_url: Option) -> SamlMetadata { SamlMetadata { metadata, download_url, diff --git a/packages/client-ts/src/models/Application.ts b/packages/client-ts/src/models/Application.ts index 0ef18805d1..284a8c10c2 100644 --- a/packages/client-ts/src/models/Application.ts +++ b/packages/client-ts/src/models/Application.ts @@ -70,7 +70,7 @@ export interface Application { * @type {Provider} * @memberof Application */ - readonly providerObj: Provider; + readonly providerObj: Provider | null; /** * * @type {Array} diff --git a/packages/client-ts/src/models/EnrollmentToken.ts b/packages/client-ts/src/models/EnrollmentToken.ts index 0c0a5ee63d..4ad823b1b6 100644 --- a/packages/client-ts/src/models/EnrollmentToken.ts +++ b/packages/client-ts/src/models/EnrollmentToken.ts @@ -44,7 +44,7 @@ export interface EnrollmentToken { * @type {DeviceAccessGroup} * @memberof EnrollmentToken */ - readonly deviceGroupObj: DeviceAccessGroup; + readonly deviceGroupObj: DeviceAccessGroup | null; /** * * @type {string} diff --git a/packages/client-ts/src/models/SAMLMetadata.ts b/packages/client-ts/src/models/SAMLMetadata.ts index 23a8ab1217..a0c529d570 100644 --- a/packages/client-ts/src/models/SAMLMetadata.ts +++ b/packages/client-ts/src/models/SAMLMetadata.ts @@ -30,7 +30,7 @@ export interface SAMLMetadata { * @type {string} * @memberof SAMLMetadata */ - readonly downloadUrl: string; + readonly downloadUrl: string | null; } /** diff --git a/schema.yml b/schema.yml index 2a711de85e..b212867acc 100644 --- a/schema.yml +++ b/schema.yml @@ -33794,6 +33794,7 @@ components: allOf: - $ref: '#/components/schemas/Provider' readOnly: true + nullable: true backchannel_providers: type: array items: @@ -37990,6 +37991,7 @@ components: allOf: - $ref: '#/components/schemas/DeviceAccessGroup' readOnly: true + nullable: true connector: type: string format: uuid @@ -53167,6 +53169,7 @@ components: download_url: type: string readOnly: true + nullable: true required: - download_url - metadata diff --git a/web/src/admin/sources/saml/SAMLSourceViewPage.ts b/web/src/admin/sources/saml/SAMLSourceViewPage.ts index 467f2b4a36..e2f8ae5ba0 100644 --- a/web/src/admin/sources/saml/SAMLSourceViewPage.ts +++ b/web/src/admin/sources/saml/SAMLSourceViewPage.ts @@ -190,7 +190,7 @@ export class SAMLSourceViewPage extends AKElement { ${msg("Download")}