From e51d67f63a802a405bf261259bc2de9504b6ae97 Mon Sep 17 00:00:00 2001 From: Guillermo Tamanaha Date: Tue, 14 Sep 2021 17:19:18 -0300 Subject: [PATCH] Add OAuth2 Support to AudienceProcessingRegistration --- .../ModuleRegistrationResponseSample.java | 21 ++ .../sdk/generator/MpJsonSchemaGenerator.java | 2 + .../json/AudienceMembershipChangeRequest.json | 4 +- .../AudienceMembershipChangeResponse.json | 4 +- .../json/AudienceSubscriptionRequest.json | 4 +- .../json/AudienceSubscriptionResponse.json | 4 +- .../json/EventProcessingRequest_android.json | 32 +-- examples/json/EventProcessingRequest_ios.json | 34 +-- examples/json/EventProcessingResponse.json | 4 +- examples/json/ModuleRegistrationRequest.json | 4 +- examples/json/ModuleRegistrationResponse.json | 21 +- ...pplicationStateTransitionEvent_schema.json | 8 +- .../json/schema/AttributionEvent_schema.json | 8 +- ...AudienceProcessingRegistration_schema.json | 10 + ...thenticationConfiguration.Type_schema.json | 4 + .../AuthenticationConfiguration_schema.json | 10 + .../CCPAConsentStateNotification_schema.json | 8 +- examples/json/schema/ConsentState_schema.json | 8 +- examples/json/schema/CustomEvent_schema.json | 8 +- examples/json/schema/ErrorEvent_schema.json | 8 +- .../schema/EventProcessingRequest_schema.json | 8 +- examples/json/schema/Event_schema.json | 8 +- .../GDPRConsentStateNotification_schema.json | 8 +- .../json/schema/ImpressionEvent_schema.json | 8 +- .../ModuleRegistrationResponse_schema.json | 10 + ...Authentication.AccessTokenType_schema.json | 4 + ...OAuth2Authentication.GrantType_schema.json | 4 + .../schema/OAuth2Authentication_schema.json | 61 +++++ .../PrivacySettingChangeEvent_schema.json | 8 +- .../schema/ProductActionEvent_schema.json | 8 +- .../schema/PromotionActionEvent_schema.json | 8 +- .../schema/PushMessageOpenEvent_schema.json | 8 +- .../PushMessageReceiptEvent_schema.json | 8 +- .../schema/PushSubscriptionEvent_schema.json | 8 +- examples/json/schema/ScopeDetail_schema.json | 14 + .../json/schema/ScreenViewEvent_schema.json | 8 +- .../json/schema/SessionEndEvent_schema.json | 8 +- .../json/schema/SessionStartEvent_schema.json | 8 +- .../schema/SystemNotification_schema.json | 8 +- examples/json/schema/TextSetting_schema.json | 4 +- .../UserAttributeChangeEvent_schema.json | 8 +- .../UserIdentityChangeEvent_schema.json | 8 +- .../AudienceProcessingRegistration.java | 20 +- .../AuthenticationConfiguration.java | 37 +++ .../authentication/OAuth2Authentication.java | 246 ++++++++++++++++++ .../authentication/ScopeDetail.java | 47 ++++ .../mparticle/sdk/AudienceV2ImportTest.java | 75 ++++++ 47 files changed, 718 insertions(+), 138 deletions(-) create mode 100644 examples/json/schema/AuthenticationConfiguration.Type_schema.json create mode 100644 examples/json/schema/AuthenticationConfiguration_schema.json create mode 100644 examples/json/schema/OAuth2Authentication.AccessTokenType_schema.json create mode 100644 examples/json/schema/OAuth2Authentication.GrantType_schema.json create mode 100644 examples/json/schema/OAuth2Authentication_schema.json create mode 100644 examples/json/schema/ScopeDetail_schema.json create mode 100644 sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/AuthenticationConfiguration.java create mode 100644 sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/OAuth2Authentication.java create mode 100644 sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/ScopeDetail.java diff --git a/examples/generator/src/main/java/com/mparticle/sdk/generator/ModuleRegistrationResponseSample.java b/examples/generator/src/main/java/com/mparticle/sdk/generator/ModuleRegistrationResponseSample.java index ed1c0e0..ee23825 100644 --- a/examples/generator/src/main/java/com/mparticle/sdk/generator/ModuleRegistrationResponseSample.java +++ b/examples/generator/src/main/java/com/mparticle/sdk/generator/ModuleRegistrationResponseSample.java @@ -3,6 +3,8 @@ import com.mparticle.sdk.model.eventprocessing.*; import com.mparticle.sdk.model.eventprocessing.notification.SystemNotification; import com.mparticle.sdk.model.registration.*; +import com.mparticle.sdk.model.registration.authentication.OAuth2Authentication; +import com.mparticle.sdk.model.registration.authentication.ScopeDetail; import java.util.*; @@ -43,8 +45,27 @@ public static Map.Entry GenerateMessage() { // Set up Audience Registration. AudienceProcessingRegistration audienceRegistration = new AudienceProcessingRegistration(); + OAuth2Authentication authentication = new OAuth2Authentication(); + + authentication + .setAuthorizationUrl("TEST_AUTHORIZATION_URL") + .setRefreshUrl("TEST_REFRESH_URL") + .setTokenUrl("TEST_TOKEN_URL") + .setGrantType(OAuth2Authentication.GrantType.AUTHORIZATION_CODE) + .setDefaultExpiresIn(2000) + .setClientId("TEST_CLIENT_ID") + .setAccessTokenType(OAuth2Authentication.AccessTokenType.CUSTOM_HEADER) + .setCustomHeaderName("TEST_CUSTOMER_HEADER_NAME") + .setParamClientIdName("TEST_PARAM_CLIENT_ID_NAME") + .setParamSecretName("TEST_PARAM_SECRET_NAME") + .setScopes(new ScopeDetail[]{new ScopeDetail() + .setName("TEST_SCOPE_NAME_1") + .setDescription("TEST_SCOPE_DESCRIPTION_1") + }); + audienceRegistration .setAudienceConnectionSettings(Collections.singletonList(getAudienceSetting())) + .setAuthentication(authentication) .setAccountSettings(Arrays.asList( getApiKeySetting(), getCustomerIdSetting() diff --git a/examples/generator/src/main/java/com/mparticle/sdk/generator/MpJsonSchemaGenerator.java b/examples/generator/src/main/java/com/mparticle/sdk/generator/MpJsonSchemaGenerator.java index f913af3..3ab56cd 100644 --- a/examples/generator/src/main/java/com/mparticle/sdk/generator/MpJsonSchemaGenerator.java +++ b/examples/generator/src/main/java/com/mparticle/sdk/generator/MpJsonSchemaGenerator.java @@ -30,6 +30,7 @@ public class MpJsonSchemaGenerator { private static final String REGISTRATION_PKG = "com.mparticle.sdk.model.registration"; + private static final String AUTHENTICATION_PKG = "com.mparticle.sdk.model.registration.authentication"; private static final String EVENT_PROCESSING_PKG = "com.mparticle.sdk.model.eventprocessing"; private static final String CONSENT_PROCESSING_PKG = "com.mparticle.sdk.model.eventprocessing.consent"; private static final String SYSTEM_NOTIFICATION_PROCESSING_PKG = "com.mparticle.sdk.model.eventprocessing.notification"; @@ -58,6 +59,7 @@ public static void main(String[] args) throws RuntimeException, IOException generateSchema(EVENT_PROCESSING_PKG, dir); generateSchema(CONSENT_PROCESSING_PKG, dir); generateSchema(SYSTEM_NOTIFICATION_PROCESSING_PKG, dir); + generateSchema(AUTHENTICATION_PKG, dir); // Collect the data which will be used for the JSON sample files List> messageClasses = Arrays.asList( diff --git a/examples/json/AudienceMembershipChangeRequest.json b/examples/json/AudienceMembershipChangeRequest.json index 17b325a..91e8f05 100644 --- a/examples/json/AudienceMembershipChangeRequest.json +++ b/examples/json/AudienceMembershipChangeRequest.json @@ -1,7 +1,7 @@ { "type" : "audience_membership_change_request", - "id" : "a4f9d492-2bac-41bc-98c8-e58ecfc5b270", - "timestamp_ms" : 1617747719154, + "id" : "af4d17ae-27d7-4dff-87b2-cdffa35eb67f", + "timestamp_ms" : 1631621810984, "firehose_version" : "2.6.0", "account" : { "account_id" : 123456, diff --git a/examples/json/AudienceMembershipChangeResponse.json b/examples/json/AudienceMembershipChangeResponse.json index 1853ea8..1aa1b89 100644 --- a/examples/json/AudienceMembershipChangeResponse.json +++ b/examples/json/AudienceMembershipChangeResponse.json @@ -1,7 +1,7 @@ { "type" : "audience_membership_change_response", - "id" : "18296c89-ed9d-42d3-899e-107adff3204c", - "timestamp_ms" : 1617747719158, + "id" : "c1402793-c0bf-42eb-a9db-972e479aa6a5", + "timestamp_ms" : 1631621810986, "firehose_version" : "2.6.0", "suspend_subscription" : false } \ No newline at end of file diff --git a/examples/json/AudienceSubscriptionRequest.json b/examples/json/AudienceSubscriptionRequest.json index 93b31ef..f62f640 100644 --- a/examples/json/AudienceSubscriptionRequest.json +++ b/examples/json/AudienceSubscriptionRequest.json @@ -1,7 +1,7 @@ { "type" : "audience_subscription_request", - "id" : "6a61522c-78df-440d-b943-54f55859aba6", - "timestamp_ms" : 1617747719158, + "id" : "3893d53c-46e9-4e86-9580-105b16d0972d", + "timestamp_ms" : 1631621810986, "firehose_version" : "2.6.0", "account" : { "account_id" : 123456, diff --git a/examples/json/AudienceSubscriptionResponse.json b/examples/json/AudienceSubscriptionResponse.json index a54fcee..8c8760c 100644 --- a/examples/json/AudienceSubscriptionResponse.json +++ b/examples/json/AudienceSubscriptionResponse.json @@ -1,7 +1,7 @@ { "type" : "audience_subscription_response", - "id" : "40a39483-53c1-4da3-8bdf-901bcd780211", - "timestamp_ms" : 1617747719159, + "id" : "d28f0562-294d-4ec3-979a-e079d52675cc", + "timestamp_ms" : 1631621810986, "firehose_version" : "2.6.0", "audience_subscription_settings" : { "sample setting" : "sample setting value", diff --git a/examples/json/EventProcessingRequest_android.json b/examples/json/EventProcessingRequest_android.json index 96c6162..05e19b8 100644 --- a/examples/json/EventProcessingRequest_android.json +++ b/examples/json/EventProcessingRequest_android.json @@ -1,9 +1,9 @@ { "type" : "event_processing_request", - "id" : "89aa633d-b642-43dc-a0db-f6a4ca74009e", - "timestamp_ms" : 1617747719164, + "id" : "ddf63e72-d39e-4cd0-bcc2-0dd39ae20bca", + "timestamp_ms" : 1631621810990, "firehose_version" : "2.6.0", - "source_id" : "baddf0ab-5ede-47f9-9492-cf7df84fca90", + "source_id" : "f90b4647-e174-4a50-89f2-9123526a1c37", "account" : { "account_id" : 123456, "account_settings" : { @@ -94,9 +94,9 @@ }, "events" : [ { "type" : "custom_event", - "id" : "27f2844b-532c-483d-a9d2-cf725dcc35e6", - "timestamp_ms" : 1617747719160, - "source_id" : "37ced462-1fb0-4eba-b053-064e9d7ac85e", + "id" : "e0e4b76e-6b52-4b26-8924-38ca6bca1025", + "timestamp_ms" : 1631621810987, + "source_id" : "01c9ba35-a409-4110-9565-d3e9582ee56a", "session_id" : 123456789, "location" : { "latitude" : 47.6062, @@ -110,9 +110,9 @@ } }, { "type" : "product_action", - "id" : "b14be118-c73e-4ace-9292-76d7893b0380", - "timestamp_ms" : 1617747719160, - "source_id" : "6a971e36-7bbb-4062-a06f-1c4bd49c1006", + "id" : "c92ac304-5cc8-4545-a592-add6887107c6", + "timestamp_ms" : 1631621810987, + "source_id" : "3116ea3f-ffba-4e34-b98b-79a726bd85c5", "session_id" : 123456789, "action" : "add_to_cart", "transaction_id" : "transactionId", @@ -137,13 +137,13 @@ } } ], "source_channel" : "native", - "device_application_stamp" : "5ad3ed4f-2b9a-4ba0-a978-8ddf1f460659", + "device_application_stamp" : "008fba59-a768-4fc4-b93e-ff2d83204ff3", "consent_state" : { "gdpr_consent_state" : { "consentPurpose" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -152,7 +152,7 @@ "data_sale_opt_out" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -164,14 +164,14 @@ "old_gdpr_consent_state" : { "consented" : false, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" }, "new_gdpr_consent_state" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -181,14 +181,14 @@ "old_ccpa_consent_state" : { "consented" : false, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" }, "new_ccpa_consent_state" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } diff --git a/examples/json/EventProcessingRequest_ios.json b/examples/json/EventProcessingRequest_ios.json index f6ba73a..b526114 100644 --- a/examples/json/EventProcessingRequest_ios.json +++ b/examples/json/EventProcessingRequest_ios.json @@ -1,9 +1,9 @@ { "type" : "event_processing_request", - "id" : "1ce441ed-55bb-4610-b308-419506da3f7a", - "timestamp_ms" : 1617747719161, + "id" : "58da0593-733e-43da-9dfb-6d49e3cf76ba", + "timestamp_ms" : 1631621810987, "firehose_version" : "2.6.0", - "source_id" : "58343599-1415-4278-874f-9b0ac8315dee", + "source_id" : "754b5e6b-a9d8-4403-b48d-430a66132d07", "account" : { "account_id" : 123456, "account_settings" : { @@ -101,13 +101,13 @@ } }, "att_authorization_status" : "authorized", - "att_timestamp_unixtime_ms" : 1617747719162 + "att_timestamp_unixtime_ms" : 1631621810987 }, "events" : [ { "type" : "custom_event", - "id" : "fb1f833c-f0df-4999-ab50-9a6c24a7d37d", - "timestamp_ms" : 1617747719160, - "source_id" : "937e5b40-55d8-41c9-9549-202458450bdf", + "id" : "6754205c-3581-474a-8d54-4d61010ed717", + "timestamp_ms" : 1631621810987, + "source_id" : "1530dc54-3267-4794-92cf-4a5497238240", "session_id" : 123456789, "location" : { "latitude" : 47.6062, @@ -121,9 +121,9 @@ } }, { "type" : "product_action", - "id" : "0a48ca0b-9218-420f-bca7-82a79e34a778", - "timestamp_ms" : 1617747719160, - "source_id" : "3b3a9c01-56db-4989-a5f8-868e0bfbd791", + "id" : "4a9faa3c-e366-440e-8abf-6000ddfb9797", + "timestamp_ms" : 1631621810987, + "source_id" : "320dd589-5d92-4f08-b147-165128bc63ae", "session_id" : 123456789, "action" : "add_to_cart", "transaction_id" : "transactionId", @@ -148,13 +148,13 @@ } } ], "source_channel" : "native", - "device_application_stamp" : "a5588c65-e3bd-45e3-8ed8-29db4a0f7337", + "device_application_stamp" : "b3856455-ab43-4675-ae34-e2d42f574f8c", "consent_state" : { "gdpr_consent_state" : { "consentPurpose" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -163,7 +163,7 @@ "data_sale_opt_out" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -175,14 +175,14 @@ "old_gdpr_consent_state" : { "consented" : false, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" }, "new_gdpr_consent_state" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } @@ -192,14 +192,14 @@ "old_ccpa_consent_state" : { "consented" : false, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" }, "new_ccpa_consent_state" : { "consented" : true, "document" : "document", - "timestamp_unixtime_ms" : 1617747719160, + "timestamp_unixtime_ms" : 1631621810987, "location" : "location", "hardware_id" : "hardware id" } diff --git a/examples/json/EventProcessingResponse.json b/examples/json/EventProcessingResponse.json index 41f6ccb..be399f7 100644 --- a/examples/json/EventProcessingResponse.json +++ b/examples/json/EventProcessingResponse.json @@ -1,6 +1,6 @@ { "type" : "event_processing_response", - "id" : "f874bc9b-7cb6-4c96-9234-7942efa0a9a1", - "timestamp_ms" : 1617747719165, + "id" : "103116d3-0bc5-4e6e-a82d-bb0915bbc86c", + "timestamp_ms" : 1631621810990, "firehose_version" : "2.6.0" } \ No newline at end of file diff --git a/examples/json/ModuleRegistrationRequest.json b/examples/json/ModuleRegistrationRequest.json index d36215f..6278445 100644 --- a/examples/json/ModuleRegistrationRequest.json +++ b/examples/json/ModuleRegistrationRequest.json @@ -1,6 +1,6 @@ { "type" : "module_registration_request", - "id" : "35797e43-4947-4268-9d37-d0e72f28957d", - "timestamp_ms" : 1617747719166, + "id" : "f46febd9-4032-4d1e-8004-878614aa384c", + "timestamp_ms" : 1631621810991, "firehose_version" : "2.6.0" } \ No newline at end of file diff --git a/examples/json/ModuleRegistrationResponse.json b/examples/json/ModuleRegistrationResponse.json index cba04b6..4cda22b 100644 --- a/examples/json/ModuleRegistrationResponse.json +++ b/examples/json/ModuleRegistrationResponse.json @@ -1,7 +1,7 @@ { "type" : "module_registration_response", - "id" : "60da6ca0-b5b4-4942-8f41-0c1224ecce48", - "timestamp_ms" : 1617747719167, + "id" : "c5ed8ebf-56f9-4548-9b5b-44882e18b19c", + "timestamp_ms" : 1631621810991, "firehose_version" : "2.6.0", "sdk_version" : "2.6.0", "name" : "Your Company Name", @@ -71,6 +71,23 @@ "required" : true, "confidential" : false } ], + "authentication" : { + "type" : "oauth2", + "authorization_url" : "TEST_AUTHORIZATION_URL", + "refresh_url" : "TEST_REFRESH_URL", + "token_url" : "TEST_TOKEN_URL", + "grant_type" : "authorization_code", + "default_expires_in" : 2000, + "client_id" : "TEST_CLIENT_ID", + "access_token_type" : "custom_header", + "custom_header_name" : "TEST_CUSTOMER_HEADER_NAME", + "param_client_id_name" : "TEST_PARAM_CLIENT_ID_NAME", + "param_secret_name" : "TEST_PARAM_SECRET_NAME", + "scopes" : [ { + "name" : "TEST_SCOPE_NAME_1", + "description" : "TEST_SCOPE_DESCRIPTION_1" + } ] + }, "audience_subscription_settings" : [ { "type" : "boolean", "id" : "audienceType", diff --git a/examples/json/schema/ApplicationStateTransitionEvent_schema.json b/examples/json/schema/ApplicationStateTransitionEvent_schema.json index 8caefb3..83bbed5 100644 --- a/examples/json/schema/ApplicationStateTransitionEvent_schema.json +++ b/examples/json/schema/ApplicationStateTransitionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/AttributionEvent_schema.json b/examples/json/schema/AttributionEvent_schema.json index 1544e57..d2c9c6d 100644 --- a/examples/json/schema/AttributionEvent_schema.json +++ b/examples/json/schema/AttributionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/AudienceProcessingRegistration_schema.json b/examples/json/schema/AudienceProcessingRegistration_schema.json index b1bb347..2f5e6b7 100644 --- a/examples/json/schema/AudienceProcessingRegistration_schema.json +++ b/examples/json/schema/AudienceProcessingRegistration_schema.json @@ -29,6 +29,16 @@ } } }, + "authentication" : { + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:AuthenticationConfiguration", + "properties" : { + "type" : { + "type" : "string", + "enum" : [ "oauth2" ] + } + } + }, "audience_subscription_settings" : { "type" : "array", "items" : { diff --git a/examples/json/schema/AuthenticationConfiguration.Type_schema.json b/examples/json/schema/AuthenticationConfiguration.Type_schema.json new file mode 100644 index 0000000..277e3dc --- /dev/null +++ b/examples/json/schema/AuthenticationConfiguration.Type_schema.json @@ -0,0 +1,4 @@ +{ + "type" : "string", + "enum" : [ "oauth2" ] +} \ No newline at end of file diff --git a/examples/json/schema/AuthenticationConfiguration_schema.json b/examples/json/schema/AuthenticationConfiguration_schema.json new file mode 100644 index 0000000..065ccf0 --- /dev/null +++ b/examples/json/schema/AuthenticationConfiguration_schema.json @@ -0,0 +1,10 @@ +{ + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:AuthenticationConfiguration", + "properties" : { + "type" : { + "type" : "string", + "enum" : [ "oauth2" ] + } + } +} \ No newline at end of file diff --git a/examples/json/schema/CCPAConsentStateNotification_schema.json b/examples/json/schema/CCPAConsentStateNotification_schema.json index 2422f96..d30c0d0 100644 --- a/examples/json/schema/CCPAConsentStateNotification_schema.json +++ b/examples/json/schema/CCPAConsentStateNotification_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ConsentState_schema.json b/examples/json/schema/ConsentState_schema.json index fc682a2..a15c3f7 100644 --- a/examples/json/schema/ConsentState_schema.json +++ b/examples/json/schema/ConsentState_schema.json @@ -2,11 +2,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -27,11 +27,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/CustomEvent_schema.json b/examples/json/schema/CustomEvent_schema.json index dbd580d..e4ba3d5 100644 --- a/examples/json/schema/CustomEvent_schema.json +++ b/examples/json/schema/CustomEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ErrorEvent_schema.json b/examples/json/schema/ErrorEvent_schema.json index 3dac573..cb295e0 100644 --- a/examples/json/schema/ErrorEvent_schema.json +++ b/examples/json/schema/ErrorEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/EventProcessingRequest_schema.json b/examples/json/schema/EventProcessingRequest_schema.json index 66b2f04..cd19363 100644 --- a/examples/json/schema/EventProcessingRequest_schema.json +++ b/examples/json/schema/EventProcessingRequest_schema.json @@ -210,11 +210,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -235,11 +235,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/Event_schema.json b/examples/json/schema/Event_schema.json index 99647b3..62a6a95 100644 --- a/examples/json/schema/Event_schema.json +++ b/examples/json/schema/Event_schema.json @@ -177,11 +177,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -202,11 +202,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/GDPRConsentStateNotification_schema.json b/examples/json/schema/GDPRConsentStateNotification_schema.json index 53bbcbc..0d94b75 100644 --- a/examples/json/schema/GDPRConsentStateNotification_schema.json +++ b/examples/json/schema/GDPRConsentStateNotification_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ImpressionEvent_schema.json b/examples/json/schema/ImpressionEvent_schema.json index 4de3113..8936bac 100644 --- a/examples/json/schema/ImpressionEvent_schema.json +++ b/examples/json/schema/ImpressionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ModuleRegistrationResponse_schema.json b/examples/json/schema/ModuleRegistrationResponse_schema.json index 51f72b9..4790c85 100644 --- a/examples/json/schema/ModuleRegistrationResponse_schema.json +++ b/examples/json/schema/ModuleRegistrationResponse_schema.json @@ -208,6 +208,16 @@ "$ref" : "urn:jsonschema:com:mparticle:sdk:model:registration:Setting" } }, + "authentication" : { + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:AuthenticationConfiguration", + "properties" : { + "type" : { + "type" : "string", + "enum" : [ "oauth2" ] + } + } + }, "audience_subscription_settings" : { "type" : "array", "items" : { diff --git a/examples/json/schema/OAuth2Authentication.AccessTokenType_schema.json b/examples/json/schema/OAuth2Authentication.AccessTokenType_schema.json new file mode 100644 index 0000000..cce7392 --- /dev/null +++ b/examples/json/schema/OAuth2Authentication.AccessTokenType_schema.json @@ -0,0 +1,4 @@ +{ + "type" : "string", + "enum" : [ "bearer", "custom_header" ] +} \ No newline at end of file diff --git a/examples/json/schema/OAuth2Authentication.GrantType_schema.json b/examples/json/schema/OAuth2Authentication.GrantType_schema.json new file mode 100644 index 0000000..e0fb3ea --- /dev/null +++ b/examples/json/schema/OAuth2Authentication.GrantType_schema.json @@ -0,0 +1,4 @@ +{ + "type" : "string", + "enum" : [ "authorization_code" ] +} \ No newline at end of file diff --git a/examples/json/schema/OAuth2Authentication_schema.json b/examples/json/schema/OAuth2Authentication_schema.json new file mode 100644 index 0000000..cfa76f7 --- /dev/null +++ b/examples/json/schema/OAuth2Authentication_schema.json @@ -0,0 +1,61 @@ +{ + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:OAuth2Authentication", + "properties" : { + "type" : { + "type" : "string", + "enum" : [ "oauth2" ] + }, + "authorization_url" : { + "type" : "string", + "required" : true + }, + "refresh_url" : { + "type" : "string" + }, + "token_url" : { + "type" : "string", + "required" : true + }, + "grant_type" : { + "type" : "string", + "enum" : [ "authorization_code" ] + }, + "default_expires_in" : { + "type" : "integer" + }, + "client_id" : { + "type" : "string" + }, + "access_token_type" : { + "type" : "string", + "enum" : [ "bearer", "custom_header" ] + }, + "custom_header_name" : { + "type" : "string" + }, + "param_client_id_name" : { + "type" : "string" + }, + "param_secret_name" : { + "type" : "string" + }, + "scopes" : { + "type" : "array", + "items" : { + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:ScopeDetail", + "properties" : { + "name" : { + "type" : "string", + "required" : true + }, + "description" : { + "type" : "string", + "required" : true + } + } + } + } + } +} \ No newline at end of file diff --git a/examples/json/schema/PrivacySettingChangeEvent_schema.json b/examples/json/schema/PrivacySettingChangeEvent_schema.json index 4cd166b..c095918 100644 --- a/examples/json/schema/PrivacySettingChangeEvent_schema.json +++ b/examples/json/schema/PrivacySettingChangeEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ProductActionEvent_schema.json b/examples/json/schema/ProductActionEvent_schema.json index cf96103..04b0adc 100644 --- a/examples/json/schema/ProductActionEvent_schema.json +++ b/examples/json/schema/ProductActionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/PromotionActionEvent_schema.json b/examples/json/schema/PromotionActionEvent_schema.json index 8817790..a66c8f4 100644 --- a/examples/json/schema/PromotionActionEvent_schema.json +++ b/examples/json/schema/PromotionActionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/PushMessageOpenEvent_schema.json b/examples/json/schema/PushMessageOpenEvent_schema.json index fd0f101..760555a 100644 --- a/examples/json/schema/PushMessageOpenEvent_schema.json +++ b/examples/json/schema/PushMessageOpenEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/PushMessageReceiptEvent_schema.json b/examples/json/schema/PushMessageReceiptEvent_schema.json index f6d4b69..cbedfef 100644 --- a/examples/json/schema/PushMessageReceiptEvent_schema.json +++ b/examples/json/schema/PushMessageReceiptEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/PushSubscriptionEvent_schema.json b/examples/json/schema/PushSubscriptionEvent_schema.json index ed0726b..630838a 100644 --- a/examples/json/schema/PushSubscriptionEvent_schema.json +++ b/examples/json/schema/PushSubscriptionEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/ScopeDetail_schema.json b/examples/json/schema/ScopeDetail_schema.json new file mode 100644 index 0000000..3303a51 --- /dev/null +++ b/examples/json/schema/ScopeDetail_schema.json @@ -0,0 +1,14 @@ +{ + "type" : "object", + "id" : "urn:jsonschema:com:mparticle:sdk:model:registration:authentication:ScopeDetail", + "properties" : { + "name" : { + "type" : "string", + "required" : true + }, + "description" : { + "type" : "string", + "required" : true + } + } +} \ No newline at end of file diff --git a/examples/json/schema/ScreenViewEvent_schema.json b/examples/json/schema/ScreenViewEvent_schema.json index 6fd8c92..e16a1b4 100644 --- a/examples/json/schema/ScreenViewEvent_schema.json +++ b/examples/json/schema/ScreenViewEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/SessionEndEvent_schema.json b/examples/json/schema/SessionEndEvent_schema.json index c87b7bd..0b40422 100644 --- a/examples/json/schema/SessionEndEvent_schema.json +++ b/examples/json/schema/SessionEndEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/SessionStartEvent_schema.json b/examples/json/schema/SessionStartEvent_schema.json index c62d488..1b6dc2b 100644 --- a/examples/json/schema/SessionStartEvent_schema.json +++ b/examples/json/schema/SessionStartEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/SystemNotification_schema.json b/examples/json/schema/SystemNotification_schema.json index cab6142..1701712 100644 --- a/examples/json/schema/SystemNotification_schema.json +++ b/examples/json/schema/SystemNotification_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/TextSetting_schema.json b/examples/json/schema/TextSetting_schema.json index 93460fd..c13cb2f 100644 --- a/examples/json/schema/TextSetting_schema.json +++ b/examples/json/schema/TextSetting_schema.json @@ -6,10 +6,10 @@ "type" : "string", "enum" : [ "text", "integer", "float", "boolean" ] }, - "required" : { + "confidential" : { "type" : "boolean" }, - "confidential" : { + "required" : { "type" : "boolean" }, "visible" : { diff --git a/examples/json/schema/UserAttributeChangeEvent_schema.json b/examples/json/schema/UserAttributeChangeEvent_schema.json index e19aead..fca38bd 100644 --- a/examples/json/schema/UserAttributeChangeEvent_schema.json +++ b/examples/json/schema/UserAttributeChangeEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/examples/json/schema/UserIdentityChangeEvent_schema.json b/examples/json/schema/UserIdentityChangeEvent_schema.json index 66764e0..0d9d4e3 100644 --- a/examples/json/schema/UserIdentityChangeEvent_schema.json +++ b/examples/json/schema/UserIdentityChangeEvent_schema.json @@ -218,11 +218,11 @@ "type" : "object", "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:ConsentState", "properties" : { - "ccpa" : { + "gdpr" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", "properties" : { "consented" : { "type" : "boolean", @@ -243,11 +243,11 @@ } } }, - "gdpr" : { + "ccpa" : { "type" : "object", "additionalProperties" : { "type" : "object", - "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:GDPRConsent", + "id" : "urn:jsonschema:com:mparticle:sdk:model:eventprocessing:consent:CCPAConsent", "properties" : { "consented" : { "type" : "boolean", diff --git a/sdk/src/main/java/com/mparticle/sdk/model/registration/AudienceProcessingRegistration.java b/sdk/src/main/java/com/mparticle/sdk/model/registration/AudienceProcessingRegistration.java index d0e05f1..d070faf 100644 --- a/sdk/src/main/java/com/mparticle/sdk/model/registration/AudienceProcessingRegistration.java +++ b/sdk/src/main/java/com/mparticle/sdk/model/registration/AudienceProcessingRegistration.java @@ -1,6 +1,7 @@ package com.mparticle.sdk.model.registration; import com.fasterxml.jackson.annotation.JsonProperty; +import com.mparticle.sdk.model.registration.authentication.AuthenticationConfiguration; import java.util.List; @@ -12,7 +13,8 @@ public final class AudienceProcessingRegistration { @JsonProperty("account_settings") private List accountSettings; - + @JsonProperty("authentication") + private AuthenticationConfiguration authentication; @JsonProperty("audience_subscription_settings") private List audienceConnectionSettings; @@ -63,4 +65,20 @@ public AudienceProcessingRegistration setAudienceConnectionSettings(List getAudienceConnectionSettings() { return audienceConnectionSettings; } + + /** + * + * @return authentication + */ + public AuthenticationConfiguration getAuthentication() { return authentication; } + + /** + * + * @param authentication audience authentication settings + * @return this + */ + public AudienceProcessingRegistration setAuthentication(AuthenticationConfiguration authentication) { + this.authentication = authentication; + return this; + } } diff --git a/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/AuthenticationConfiguration.java b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/AuthenticationConfiguration.java new file mode 100644 index 0000000..4deceb4 --- /dev/null +++ b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/AuthenticationConfiguration.java @@ -0,0 +1,37 @@ +package com.mparticle.sdk.model.registration.authentication; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "oauth2", value = OAuth2Authentication.class), +}) +public abstract class AuthenticationConfiguration { + + public AuthenticationConfiguration(Type type){ + this.type = type; + } + + private final Type type; + + /** + * + * @return authentication type + */ + public Type getType() { return type; } + + public enum Type { + OAUTH2; + + @Override + public String toString() { + return this.name().toLowerCase(); + } + } +} + diff --git a/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/OAuth2Authentication.java b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/OAuth2Authentication.java new file mode 100644 index 0000000..69af136 --- /dev/null +++ b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/OAuth2Authentication.java @@ -0,0 +1,246 @@ +package com.mparticle.sdk.model.registration.authentication; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public final class OAuth2Authentication extends AuthenticationConfiguration { + + public OAuth2Authentication() + { + super(Type.OAUTH2); + } + + @JsonProperty(value="authorization_url", required = true) + private String authorizationUrl; + + @JsonProperty(value="refresh_url") + private String refreshUrl; + + @JsonProperty(value="token_url", required = true) + private String tokenUrl; + + @JsonProperty(value="grant_type") + private GrantType grantType; + + @JsonProperty(value="default_expires_in") + private Integer defaultExpiresIn; + + @JsonProperty(value="client_id") + private String clientId; + + @JsonProperty(value="access_token_type") + private AccessTokenType accessTokenType; + + @JsonProperty(value="custom_header_name") + private String customHeaderName; + + @JsonProperty(value="param_client_id_name") + private String paramClientIdName; + + @JsonProperty(value="param_secret_name") + private String paramSecretName; + + @JsonProperty(value="scopes") + private ScopeDetail[] scopes; + + /** + * + * @return Authorization Url + */ + public String getAuthorizationUrl() { return authorizationUrl; } + + /** + * + * @param authorizationUrl Authorization Url + * @return this + */ + public OAuth2Authentication setAuthorizationUrl(String authorizationUrl) { + this.authorizationUrl = authorizationUrl; + return this; + } + + /** + * + * @return Refresh URL + */ + public String getRefreshUrl() { return refreshUrl; } + + /** + * + * @param refreshUrl Refresh URL + * @return this + */ + public OAuth2Authentication setRefreshUrl(String refreshUrl) { + this.refreshUrl = refreshUrl; + return this; + } + + /** + * + * @return Token Url + */ + public String getTokenUrl() { return tokenUrl; } + + /** + * + * @param tokenUrl Token Url + * @return this + */ + public OAuth2Authentication setTokenUrl(String tokenUrl) { + this.tokenUrl = tokenUrl; + return this; + } + + /** + * + * @return Method used to gain Access Tokens + */ + public GrantType getGrantType() { return grantType; } + + /** + * + * @param grantType Method used to gain Access Tokens + * @return this + */ + public OAuth2Authentication setGrantType(GrantType grantType) { + this.grantType = grantType; + return this; + } + + /** + * + * @return duration of time the access token is granted for + */ + public int getDefaultExpiresIn() { return defaultExpiresIn; } + + /** + * + * @param defaultExpiresIn duration of time the access token is granted for + * @return this + */ + public OAuth2Authentication setDefaultExpiresIn(int defaultExpiresIn) { + this.defaultExpiresIn = defaultExpiresIn; + return this; + } + + /** + * + * @return Unique public identifier + */ + public String getClientId() { return clientId; } + + /** + * + * @param clientId Unique public identifier + * @return this + */ + public OAuth2Authentication setClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * + * @return Specifies how the access token will be provided + */ + public AccessTokenType getAccessTokenType() { + return accessTokenType; + } + + /** + * + * @param accessTokenType Specifies how the access token will be provided + * @return this + */ + public OAuth2Authentication setAccessTokenType(AccessTokenType accessTokenType) { + this.accessTokenType = accessTokenType; + return this; + } + + /** + * + * @return Name of the custom header for the access token + */ + public String getCustomHeaderName() { return customHeaderName; } + + /** + * + * @param customHeaderName Name of the custom header for the access token + * @return this + */ + public OAuth2Authentication setCustomHeaderName(String customHeaderName) { + this.customHeaderName = customHeaderName; + return this; + } + + /** + * + * @return Custom name for ClientID + */ + public String getParamClientIdName() { return paramClientIdName; } + + /** + * + * @param paramClientIdName Custom name for ClientID + * @return this + */ + public OAuth2Authentication setParamClientIdName(String paramClientIdName) { + this.paramClientIdName = paramClientIdName; + return this; + } + + /** + * + * @return Custom name for ClientSecret + */ + public String getParamSecretName() { return paramSecretName; } + + /** + * + * @param paramSecretName Custom name for ClientSecret + * @return this + */ + public OAuth2Authentication setParamSecretName(String paramSecretName) { + this.paramSecretName = paramSecretName; + return this; + } + + /** + * + * @return Scope to limit an app's access to user account + */ + public ScopeDetail[] getScopes() { + return scopes; + } + + /** + * + * @param scopes Scope to limit an app's access to user account + * @return this + */ + public OAuth2Authentication setScopes(ScopeDetail[] scopes) { + this.scopes = scopes; + return this; + } + + /** + * Specifies how the access token will be provided to the integration + */ + public enum AccessTokenType { + BEARER, + CUSTOM_HEADER; + + @Override + public String toString() { + return this.name().toLowerCase(); + } + } + + public enum GrantType { + AUTHORIZATION_CODE; + + @Override + public String toString() { + return this.name().toLowerCase(); + } + } +} diff --git a/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/ScopeDetail.java b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/ScopeDetail.java new file mode 100644 index 0000000..59eee18 --- /dev/null +++ b/sdk/src/main/java/com/mparticle/sdk/model/registration/authentication/ScopeDetail.java @@ -0,0 +1,47 @@ +package com.mparticle.sdk.model.registration.authentication; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public final class ScopeDetail { + @JsonProperty(value="name", required = true) + private String name; + + @JsonProperty(value="description", required = true) + private String description; + + /** + * + * @return Description of the scope + */ + public String getDescription() { + return description; + } + + /** + * + * @param description Description of the scope + * @return this + */ + public ScopeDetail setDescription(String description) { + this.description = description; + return this; + } + + /** + * + * @return Name of the OAuth2 Scope + */ + public String getName() { + return name; + } + + /** + * + * @param name Name of the OAuth2 Scope + * @return this + */ + public ScopeDetail setName(String name) { + this.name = name; + return this; + } +} diff --git a/sdk/src/test/java/com/mparticle/sdk/AudienceV2ImportTest.java b/sdk/src/test/java/com/mparticle/sdk/AudienceV2ImportTest.java index fa00cbe..3576ba0 100644 --- a/sdk/src/test/java/com/mparticle/sdk/AudienceV2ImportTest.java +++ b/sdk/src/test/java/com/mparticle/sdk/AudienceV2ImportTest.java @@ -7,6 +7,12 @@ import com.mparticle.sdk.model.eventprocessing.PartnerIdentity; import com.mparticle.sdk.model.eventprocessing.UserIdentity; import com.mparticle.sdk.model.registration.Account; +import com.mparticle.sdk.model.registration.AudienceProcessingRegistration; +import com.mparticle.sdk.model.registration.ModuleRegistrationResponse; +import com.mparticle.sdk.model.registration.authentication.OAuth2Authentication; +import com.mparticle.sdk.model.registration.authentication.OAuth2Authentication.GrantType; +import com.mparticle.sdk.model.registration.authentication.OAuth2Authentication.AccessTokenType; +import com.mparticle.sdk.model.registration.authentication.ScopeDetail; import org.junit.jupiter.api.*; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -219,6 +225,75 @@ public void AudienceAndListAttributeTest(SimpleImmutableEntry