Changes for page Groovy Script
Last modified by Erik Bakker on 2024/09/05 13:53
From version 7.1
edited by Erik Bakker
on 2022/07/26 09:05
on 2022/07/26 09:05
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 (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - expert-create-your-transformations-xpath-expert1 +API Gateway Security - External IDP - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,5 +1,5 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 - Within the crash course,we already explainedXPathconceptually.Inthatsamemicrolearning,welookedatsome more uncomplicatedcases of using XPathwithin your transformation. If you need to brushup on that knowledge, pleasecheck outthis[[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]].Inthe intermediatemicrolearning on this subject, we builtupon that knowledge. Please check out this[[microlearning>>doc:Main.eMagizAcademy.Microlearnings.Intermediate Level.Createyour transformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]]if you needa refresheron that.Inthe [[microlearning>>doc:Main.eMagizAcademy.Microlearnings.Advanced Level.Createyourtransformations.advanced-create-your-transformations-xpath-advanced.WebHome||target="blank"]]that followed, we builtuponthatknowledgeandlookedat someconcrete,practicalexamplesthat couldbeusefulinyour project. In thismicrolearning, wewill wraptheconceptfXPath by lookingatthreecomplexXPathalternatives that aresometimes neededwhendealingwith messages in eMagiz.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 ... ... @@ -6,82 +6,54 @@ 6 6 == 1. Prerequisites == 7 7 8 8 * Expert knowledge of the eMagiz platform 9 -* [[XPath Basic>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]] 10 -* [[XPath Intermediate>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Create your transformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]] 11 -* [[XPath Advanced>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Create your transformations.advanced-create-your-transformations-xpath-advanced.WebHome||target="blank"]] 12 12 13 - 14 14 == 2. Key concepts == 15 15 16 -This microlearning focuses on verycomplexXPath operations.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. 17 17 18 -With XPath Expert, we mean learning that XPath options are sometimes very complex but could benefit you in specific cases in your daily work. 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 19 19 20 - Someofthevery complexXPathoptions are:17 +== 3. External IDP == 21 21 22 -* matches 23 -* replace 24 -* tokenize 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. 25 25 26 - ==3.XPathExpert==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. 27 27 28 - Within the crash course, we already explained XPath conceptually.In thatsamemicrolearning,welooked at some more uncomplicated cases of using XPathwithin your transformation. If you need to brush up on that knowledge, pleasecheck out this [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.CrashCourse.Crash Course Platform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]]. In the intermediatemicrolearning on this subject,we built upon thatknowledge. Please check outthis [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.IntermediateLevel.Create yourtransformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]] if youneed arefresheron that. In the [[microlearning>>doc:Main.eMagizAcademy.Microlearnings.AdvancedLevel.Create your transformations.advanced-create-your-transformations-xpath-advanced.WebHome||target="blank"]]that followed, we built upon that knowledge and lookedatsomeconcrete, practical examples that could beuseful in your project. In thismicrolearning,we will wrapthe concept of XPath by lookingatthreecomplex XPath alternatives that are sometimes needed when dealingwithmessages in eMagiz.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. 29 29 30 - Someofthevery complex XPath optionsare:25 +=== 3.1 Design === 31 31 32 -* matches 33 -* replace 34 -* tokenize 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. 35 35 36 - === 3.1matches===29 +[[image:Main.Images.Microlearning.WebHome@expert-securing-data-traffic-api-gw-security-external-idp-security-config-design.png]] 37 37 38 - Sometimes,you wantto determine whetheraspecific value withinyour payload matchesa pattern. In those cases, you can use the XPath functioncalledmatches. The functionwill return trueifthesuppliedstring matches a given regularexpression.So, forxample, if you want tocheckwhetheryour OrderID containsexactlysevendigits andnothingelse,the following XPathexpressionwill work foryourusecase.31 +Note that the environmentID in this example should be replaced with an actual environmentID that references your environment. 39 39 40 - matches(OrderID,'^\d{7}$')33 +=== 3.2 Deploy === 41 41 42 - As aresult,youwillget a true or false backwhichyoucan then useasafilteror within anif-then-else construction.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. 43 43 44 - ===3.2replace===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. 45 45 46 - The replace function hasmany similarities with the matches function.t builds on the premise of the matchesfunction, but instead ofreturninga truer false, you can statewith what you want to replacehematched string. In other words,this function returnsastring producedfrom theinput stringby replacing any substringsthat match a given regular expressionwithasuppliedreplacement string.39 +[[image:Main.Images.Microlearning.WebHome@expert-securing-data-traffic-api-gw-security-external-idp-scope-configuration.png]] 47 47 48 -When we applythisto our earlierexample,wecanstatethatwhentheOrderID contains anynon-digit,wewillreplacethis value with nothing.Thiswill lead to thefollowingXPathexpression.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}} 49 49 50 -replace(OrderID,'\D','') 51 - 52 -With a given input string of 12C34A567, the returned result will be 1234567. 53 - 54 -=== 3.3 tokenize === 55 - 56 -The tokenize function can split a string into multiple entries for you. This is particularly useful when you want to match an input string to a list of possible values that are valid for that string. For example, the function returns a sequence of strings constructed by splitting the input wherever a separator is found; the separator is any substring that matches a given regular expression. 57 - 58 -So, for example, when the input string for AddressID is "street,housenumber,housenumberaddition" and you want to tokenize this with the help of the separator, you could use, in this example, the comma between the values as the separator. This will lead to the following XPath expression. 59 - 60 -tokenize(AddressID,',') 61 - 62 -The given input detailed above will result in the following output: street housenumber housenumberaddition. 63 - 64 64 == 4. Assignment == 65 65 66 -Check out which of the XPaths we have discussed today can be found within your project. 67 -This assignment can be completed within the (Academy) project you created/used in the previous assignment. 45 +No assignment 68 68 69 69 == 5. Key takeaways == 70 70 71 -Some of the very complex XPath options are: 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. 72 72 73 -* matches 74 -* replace 75 -* tokenize 76 - 77 77 == 6. Suggested Additional Readings == 78 78 79 -If you are interested in this topic and want more information on it, please read the help text provided by eMagizand read more information on the following links:55 +If you are interested in this topic and want more information, please read the help text provided by eMagiz. 80 80 81 -* http://www.xsltfunctions.com/xsl/fn_matches.html 82 -* http://www.xsltfunctions.com/xsl/fn_replace.html 83 -* http://www.xsltfunctions.com/xsl/fn_tokenize.html 84 - 85 85 == 7. Silent demonstration video == 86 86 87 87 As this is more of theoretical microlearning, there is no video accompanying the microlearning.)))((({{toc/}}))){{/container}}{{/container}}