{"id":1479,"date":"2015-01-31T00:48:21","date_gmt":"2015-01-31T06:48:21","guid":{"rendered":"https:\/\/www.identityblog.com\/?page_id=1479"},"modified":"2015-01-31T00:48:21","modified_gmt":"2015-01-31T06:48:21","slug":"formatstringmultipleclaims-transformation","status":"publish","type":"page","link":"https:\/\/www.identityblog.com\/?page_id=1479","title":{"rendered":"FormatStringMultipleClaims Transformation"},"content":{"rendered":"<div>A FormatStringMultipleClaims transformation formats two claims defined in the policy schema by using a format string defined as an input parameter. The format string is applied using the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/System.String.Format(v=vs.110).aspx\">.NET System.String Format<\/a> method. The formatted result is returned as the transformation&#8217;s output claim.<\/div>\n<p>&nbsp;<\/p>\n<div>\n<table style=\"border-collapse: collapse; background: #e2efd9;\" border=\"0\">\n<colgroup>\n<col style=\"width: 615px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"padding-left: 9px; padding-right: 9px; border: solid #bfbfbf 0.5pt;\">\n<p style=\"text-align: center;\"><span style=\"font-size: 12pt;\"><strong>InputClaims<\/strong><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse;\" border=\"0\">\n<colgroup>\n<col style=\"width: 277px;\" \/>\n<col style=\"width: 338px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr style=\"background: white;\">\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>TransformationClaimType<\/em><\/span><\/p>\n<\/td>\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\"><span style=\"font-size: 13pt;\"><em>Description<\/em><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"background: white; padding-left: 9px; padding-right: 9px; border-right: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>inputClaim1<\/em><\/span><\/p>\n<\/td>\n<td style=\"background: #f2f2f2; padding-left: 9px; padding-right: 9px;\">The first claim whose value is to be formatted<\/td>\n<\/tr>\n<tr>\n<td style=\"background: white; padding-left: 9px; padding-right: 9px; border-right: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>inputClaim2<\/em><\/span><\/p>\n<\/td>\n<td style=\"background: #f2f2f2; padding-left: 9px; padding-right: 9px;\">The second claim whose value is to be formatted<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse; background: #e2efd9;\" border=\"0\">\n<colgroup>\n<col style=\"width: 615px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"padding-left: 9px; padding-right: 9px; border: solid #bfbfbf 0.5pt;\">\n<p style=\"text-align: center;\"><span style=\"font-size: 12pt;\"><strong>InputParameters<\/strong><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse;\" border=\"0\">\n<colgroup>\n<col style=\"width: 176px;\" \/>\n<col style=\"width: 169px;\" \/>\n<col style=\"width: 278px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr style=\"background: white;\">\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>Id<\/em><\/span><\/p>\n<\/td>\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\"><span style=\"font-size: 13pt;\"><em>DataType<\/em><\/span><\/td>\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\"><span style=\"font-size: 13pt;\"><em>Value<\/em><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"background: white; padding-left: 9px; padding-right: 9px; border-right: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>stringFormat<\/em><\/span><\/p>\n<\/td>\n<td style=\"background: #f2f2f2; padding-left: 9px; padding-right: 9px;\">boolean<\/td>\n<td style=\"background: #f2f2f2; padding-left: 9px; padding-right: 9px;\">A string in which &#8216;{0}&#8217; will be replaced by the value of &#8216;inputClaim1&#8217;, and &#8216;{1}&#8217; will be replaced by the value of &#8216;inputClaim2&#8217;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse; background: #e2efd9;\" border=\"0\">\n<colgroup>\n<col style=\"width: 615px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"padding-left: 9px; padding-right: 9px; border: solid #bfbfbf 0.5pt;\">\n<p style=\"text-align: center;\"><span style=\"font-size: 12pt;\"><strong>OutputClaims<\/strong><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse;\" border=\"0\">\n<colgroup>\n<col style=\"width: 277px;\" \/>\n<col style=\"width: 338px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr style=\"background: white;\">\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>TransformationClaimType<\/em><\/span><\/p>\n<\/td>\n<td style=\"padding-left: 9px; padding-right: 9px; border-bottom: solid #7f7f7f 0.5pt;\"><span style=\"font-size: 13pt;\"><em>Description<\/em><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"background: white; padding-left: 9px; padding-right: 9px; border-right: solid #7f7f7f 0.5pt;\">\n<p style=\"text-align: right;\"><span style=\"font-size: 13pt;\"><em>outputClaim<\/em><\/span><\/p>\n<\/td>\n<td style=\"background: #f2f2f2; padding-left: 9px; padding-right: 9px;\">The formatted claim<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table style=\"border-collapse: collapse; background: #e2efd9;\" border=\"0\">\n<colgroup>\n<col style=\"width: 615px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"padding-left: 9px; padding-right: 9px; border: solid #bfbfbf 0.5pt;\">\n<p style=\"text-align: center;\"><span style=\"font-size: 12pt;\"><strong>Example<\/strong><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<p>This example defines a ClaimsTransformation of the &#8216;FormatStringMultipleClaims&#8217; type called &#8216;CreateDisplayName&#8217;.\u00a0A policy schema&#8217;s \u00a0&#8216;givenName&#8217;\u00a0and &#8216;surname&#8217; claims are formatted using a format string in which &#8216;{0}&#8217; will be replaced\u00a0by &#8216;givenName&#8217; and\u00a0&#8216;{1}&#8217; will be replaced by &#8216;surname&#8217;\u00a0. The result will be returned in the &#8216;displayName&#8217; claim from the policy schema.<\/p>\n<\/div>\n<p><!-- code formatted by http:\/\/manoli.net\/csharpformat\/ --><\/p>\n<pre class=\"csharpcode\">      \r\n<span class=\"kwrd\">&lt;<\/span><span class=\"html\">ClaimsTransformation<\/span> <span class=\"attr\">Id<\/span><span class=\"kwrd\">=\"CreateDisplayName\"<\/span> <span class=\"attr\">TransformationMethod<\/span><span class=\"kwrd\">=\"FormatStringMultipleClaims\"<\/span><span class=\"kwrd\">&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;<\/span><span class=\"html\">InputClaims<\/span><span class=\"kwrd\">&gt;<\/span>\r\n          <span class=\"kwrd\">&lt;<\/span><span class=\"html\">InputClaim<\/span> <span class=\"attr\">ClaimTypeReferenceId<\/span><span class=\"kwrd\">=\"givenName\"<\/span> <span class=\"attr\">TransformationClaimType<\/span><span class=\"kwrd\">=\"inputClaim1\"<\/span> <span class=\"kwrd\">\/&gt;<\/span>\r\n          <span class=\"kwrd\">&lt;<\/span><span class=\"html\">InputClaim<\/span> <span class=\"attr\">ClaimTypeReferenceId<\/span><span class=\"kwrd\">=\"surname\"<\/span> <span class=\"attr\">TransformationClaimType<\/span><span class=\"kwrd\">=\"inputClaim2\"<\/span> <span class=\"kwrd\">\/&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">InputClaims<\/span><span class=\"kwrd\">&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;<\/span><span class=\"html\">InputParameters<\/span><span class=\"kwrd\">&gt;<\/span>\r\n          <span class=\"kwrd\">&lt;<\/span><span class=\"html\">InputParameter<\/span> <span class=\"attr\">Id<\/span><span class=\"kwrd\">=\"formatString\"<\/span> <span class=\"attr\">DataType<\/span><span class=\"kwrd\">=\"string\"<\/span> <span class=\"attr\">Value<\/span><span class=\"kwrd\">=\"{0} {1}\"<\/span> <span class=\"kwrd\">\/&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">InputParameters<\/span><span class=\"kwrd\">&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;<\/span><span class=\"html\">OutputClaims<\/span><span class=\"kwrd\">&gt;<\/span>\r\n          <span class=\"kwrd\">&lt;<\/span><span class=\"html\">OutputClaim<\/span> <span class=\"attr\">ClaimTypeReferenceId<\/span><span class=\"kwrd\">=\"displayName\"<\/span> <span class=\"attr\">TransformationClaimType<\/span><span class=\"kwrd\">=\"outputClaim\"<\/span> <span class=\"kwrd\">\/&gt;<\/span>\r\n        <span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">OutputClaims<\/span><span class=\"kwrd\">&gt;<\/span>\r\n      <span class=\"kwrd\">&lt;\/<\/span><span class=\"html\">ClaimsTransformation<\/span><span class=\"kwrd\">&gt;<\/span>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A FormatStringMultipleClaims transformation formats two claims defined in the policy schema by using a format string defined as an input parameter. The format string is applied using the .NET System.String Format method. The formatted result is returned as the transformation&#8217;s output claim. &nbsp; InputClaims TransformationClaimType Description inputClaim1 The first claim whose value is to be &hellip; <a href=\"https:\/\/www.identityblog.com\/?page_id=1479\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">FormatStringMultipleClaims Transformation<\/span><\/a><\/p>\n","protected":false},"author":68,"featured_media":0,"parent":1453,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/pages\/1479"}],"collection":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1479"}],"version-history":[{"count":1,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/pages\/1479\/revisions"}],"predecessor-version":[{"id":1480,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/pages\/1479\/revisions\/1480"}],"up":[{"embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/pages\/1453"}],"wp:attachment":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}