Changes for page Multipart form-data
Last modified by Erik Bakker on 2024/06/17 11:39
From version 18.1
edited by Erik Bakker
on 2022/08/05 14:24
on 2022/08/05 14:24
Change comment:
There is no comment for this version
To version 11.1
edited by Erik Bakker
on 2022/07/26 13:40
on 2022/07/26 13:40
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Multipartform-data1 +API Gateway Security - External IDP - Content
-
... ... @@ -1,5 +1,5 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 - Sometimeswhenyoucall an externalRESTendpoint,theyrequire youtosendmeta information and one or more "attachments"in one calltotheRESTendpoint.To makethis possible,youneedtondtheinformationwiththecontentTypealledmultipart/form-data. In this microlearning, we will discusshowyoucanconfigureavalidmessagewithinthe eMagizplatformthat allows youtosendoutmessageswith thiscontentType andhave themacceptedby theendpointinquestion.2 +In the crash course on the API Gateway we discussed the various options available to [[secure>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course API Gateway.crashcourse-api-gateway-security.WebHome||target="blank"]] your API Gateway properly. In this microlearning, we will expand our knowledge on that topic by looking at a special case of securing your API Gateway. That case is special as you use an external identity provider (IDP) to govern the roles and users that have rights on your API Gateway. 3 3 4 4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 5 5 ... ... @@ -9,65 +9,51 @@ 9 9 10 10 == 2. Key concepts == 11 11 12 -This microlearning focuses on configuring amultipart/form-datamessagewithin eMagiz to ensureit issentcorrectly toanendpoint.12 +This microlearning focuses on using an external IDP to validate whether a user is authorized to execute a certain action on your API Gateway and what configuration is needed in eMagiz to make this work. 13 13 14 -Key aspects are: 14 +* The Token and Issuer URL of the external IDP need to be known 15 +* Users and Roles under User Management need to be manually configured and maintained to keep them in sync with the external IDP 15 15 16 -* Defining the boundary that separates the parts of the message 17 -* Defining the content types of each part of the message 18 -* Construction of the complete message according to the specification 17 +== 3. External IDP == 19 19 20 - ==3. Multipart form-data==19 +In the crash course on the API Gateway we discussed the various options available to [[secure>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course API Gateway.crashcourse-api-gateway-security.WebHome||target="blank"]] your API Gateway properly. In this microlearning, we will expand our knowledge on that topic by looking at a special case of securing your API Gateway. That case is special as you use an external identity provider (IDP) to govern the roles and users that have rights on your API Gateway. 21 21 22 - Sometimes whenyou call anexternalRESTendpoint,theyrequire youtosendmetainformationandoneor more "attachments"inonecallto theREST endpoint.Tomake thispossible, you needto sendtheinformationwith the contentType called multipart/form-data. In this microlearning,wewill discusshowyou can configure a validmessagewithin theeMagiz platformthatallowsyouto send out messageswith thiscontentTypeandhavethemacceptedbythe endpointin question.21 +When selecting the option OAuth2.0 (or OpenID Connect) you have the option to use the IDP provided by eMagiz which makes the configuration easy or you could use an external IDP which you have control over and want to use for this purposes. 23 23 24 - Keyaspectsare:23 +In this microlearning we will highlight what you need to configure in Design and Deploy to make this work within the tooling of eMagiz. 25 25 26 -* Defining the boundary that separates the parts of the message 27 -* Defining the content types of each part of the message 28 -* Construction of the complete message according to the specification 25 +=== 3.1 Design === 29 29 30 - To actually constructthemessagetherea severalstepsneededto make itork.Luckily,mostofthe stepsneededhavetodo with conceptswehavealready discussed inpreviousmicrolearnings.As youcanimagine based on what mulipart/form-dataentailsweneeda wayto bothstorethemetainformationandthefile(s)we want to sendto the externalparty.To doso it is advisableto put themetadatain one(ormultiple) header(s) and use thefilecontentas payload.Thisyoucan achievewitha headerenricherand standard transformer.27 +On the security level of the API Gateway in Design you need to select the desired option, for example OAuth2.0. Instead of not filling in the token and issuer URL, indicating that you want to use the eMagiz IDP, you need to fill these in to reference the IDP of your choice. Below you see an example of how this could be configured. 31 31 32 - Once the filecontent isyourpayload youneed toakesurethat thedata is"raw"innature. So when you haveabase64 encoded string you shoulddecode the stringbeforesendingit to the endpoint.29 +[[image:Main.Images.Microlearning.WebHome@expert-securing-data-traffic-api-gw-security-external-idp-security-config-design.png]] 33 33 34 - On topofthatwe needtodefine thecontentTypeheaderasfollows.31 +Note that the environmentID in this example should be replaced with an actual environmentID that references your environment. 35 35 36 - Mostusers would think that communication via queues to connect two separate eMagiz models is a bright idea.However, this is something that we do not encourage. We discourage this for severalpracticaland technical reasonsalike.33 +=== 3.2 Deploy === 37 37 38 - Whenlookingatthe practicalsideofthingsgettingit configured correctlyis time-consuming and an error-proneaction(asisevidentby the question).Furthermore,itcan lead tounexpected situations where you make atypo to listen toa queue onwhichnomessages are provided.This queue will, however, beregisteredontheJMS level (whenyou activatetheflowin questionwiththecustomconfiguration),which canleadtoconfusingqueuestatisticsandevenmore troublesomefalse-positivealerting based onmissingqueuemetrics ormissingconsumers.35 +Normally, eMagiz will automatically update the User Management information based on the configuration in Design. However, because the identity check is not done by eMagiz but by an external party you need to manually enter the roles and users and configure the scope correctly on role level. 39 39 40 - Ontopofthat, whenyouallowoneodeltowrite andreadfromqueuesregisteredinanothermodel,maintainingbothmodelswillbecomeverycomplex.Thisholdsfor the onesworkingontheprojectat themomentbutalsoforthose workingon itatlaterstageand doesthat needtoprovide(incidental)support on theenvironments.37 +To do so navigate to User Management in Deploy and add the users you want manually by pressing the New button and providing them with a name. Do subsequently the same for the roles. On role level do not forget to correctly enter the scope to make the call work. Note that the help text on the scope level gently reminds you what you need to do to make this work. 41 41 42 - Another practical reason fornot wantingthis is that wedonot actively supportthisusease from eMagiz. This means thatwhen we update ourtechnicalinfrastructure, we will notconsiderthis scenario. Thisuld lead toadditional work in thefutureand reduced stabilityof your solution.39 +[[image:Main.Images.Microlearning.WebHome@expert-securing-data-traffic-api-gw-security-external-idp-scope-configuration.png]] 43 43 44 - From the technical point of view, theconsequenceofthisconstructionis that both models needto knoweachothercertificatesandcredentials,whichare notconsideredsecure.On top of that,becauseyou,theoretically,can exchange datafrom any queuetoany queue,youcould createa situation in which updates in one modeltrigger changesin theothermodel (i.e.,when using thesame data model) that are unexpected (and frankly unwanted).41 +{{warning}}When implementing this you would be the first to do so with this setup. This means there might be some unexpected behavior when configuring this.{{/warning}} 45 45 46 -We advise using functionality that makes it explicit that both models function independently of each other. From eMagiz, we consider two valid alternatives for this: 47 -- Using a web service as a communication layer between the two models. This web service can be REST or SOAP and has been implemented before 48 -- Using the Event Streaming functionality of eMagiz to write and read from topics. 49 - 50 -Both alternatives have the benefit that the security can be tight and explicit (i.e., only model A can write/post data to model B). Furthermore, managing the solution becomes much easier as it uses the standard functionality within the platform. Therefore, we have no plans to support this approach in the product. 51 - 52 52 == 4. Assignment == 53 53 54 -Consider what your criteria are when communicating between models and compare them to our criteria. 55 -This assignment can be completed with the help of the (Academy) project you created/used in the previous assignment. 45 +No assignment 56 56 57 57 == 5. Key takeaways == 58 58 59 -* Consider the following when communication between two models 60 -** Security 61 -** Loose coupling 62 -** Maintainability 63 -** Clarity 49 +* The Token and Issuer URL of the external IDP need to be known 50 +* Users and Roles under User Management need to be manually configured and maintained to keep them in sync with the external IDP 51 +* When implementing this you would be the first to do so with this setup. 64 64 65 65 == 6. Suggested Additional Readings == 66 66 67 -If you are interested in this topic please read the helptext sin theplatform andreadthefollowinglink:55 +If you are interested in this topic and want more information, please read the help text provided by eMagiz. 68 68 69 -* https://www.sobyte.net/post/2021-12/learn-about-http-multipart-form-data/ 70 - 71 71 == 7. Silent demonstration video == 72 72 73 73 As this is more of theoretical microlearning, there is no video accompanying the microlearning.)))((({{toc/}}))){{/container}}{{/container}}