<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Aura – </title>
    <link>/docs/components/aura-groot/aura-groot-middlewares/</link>
    <description>Recent content on Aura</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    
	  <atom:link href="/docs/components/aura-groot/aura-groot-middlewares/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-groot/aura-groot-middlewares/channeldata-validator-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-groot/aura-groot-middlewares/channeldata-validator-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;channeldata-validator-middleware&#34;&gt;Channeldata validator middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;channeldata-validator-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of the validation of the request &lt;code&gt;channelData&lt;/code&gt; for normalized versions&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The source code of this middleware is included in this &lt;a href=&#34;https://github.com/Telefonica/aura-distributed-bot/tree/master/packages/aura-groot/src/modules/middlewares/channeldata-validator-middleware.ts&#34;&gt;Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This middleware will check if the &lt;a href=&#34;../../../../docs/components/request-response-model/channeldata-v3/&#34;&gt;&lt;code&gt;channelData&lt;/code&gt;&lt;/a&gt; of the incoming request is valid or not. This validation is made:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the environment variable &lt;code&gt;AURA_CHANNELDATA_VALIDATION&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If the incoming &lt;code&gt;channelData&lt;/code&gt; version is greater or equal than &lt;code&gt;AURA_CHANNELDATA_VALIDATION_MIN_VERSION&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If a validator for this version exists. Validators are loaded using schemas stored in &lt;a href=&#34;https://github.com/Telefonica/aura-common-utilities/tree/master/packages/aura-utilities/src/aura-models/resources/channel-data&#34;&gt;aura-models package&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the validation is ok or is not executed because one or more of the previous conditions are not satisfied, &lt;em&gt;&lt;strong&gt;aura-groot&lt;/strong&gt;&lt;/em&gt; continues the normal flow, executing the rest of middlewares.&lt;/p&gt;
&lt;p&gt;If the validation fails, the error message &lt;code&gt;core:core.model-validation.request.error&lt;/code&gt; will be returned to the user and no more middlewares will be executed.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-groot/aura-groot-middlewares/user-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-groot/aura-groot-middlewares/user-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;user-middleware&#34;&gt;User middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;user-middleware&lt;/strong&gt;&lt;/em&gt; in charge of the validation of the user&amp;rsquo;s data&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;user-middleware&lt;/strong&gt;&lt;/em&gt; is the middleware in charge of validating auraId and channel.&lt;/p&gt;
&lt;p&gt;This is needed in &lt;em&gt;&lt;strong&gt;aura-groot&lt;/strong&gt;&lt;/em&gt; because routing is currently done by channel, so if the request does not include channelId (mandatory only in &lt;a href=&#34;../../../../docs/components/request-response-model/channeldata-v3/&#34;&gt;&lt;code&gt;channelData&lt;/code&gt; v3&lt;/a&gt;), the user must be checked in &lt;a href=&#34;../../../../docs/components/aura-authentication-api/&#34;&gt;&lt;em&gt;&lt;strong&gt;aura-authentication-api&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; to obtain the channel of this user.&lt;/p&gt;
&lt;p&gt;This middleware throws an error if there is not &lt;code&gt;activity.from.id&lt;/code&gt; or if some error is returned by &lt;em&gt;&lt;strong&gt;aura-authentication-api&lt;/strong&gt;&lt;/em&gt;
(except &lt;code&gt;404&lt;/code&gt;, because anonymous users should continue the flow).&lt;/p&gt;
&lt;p&gt;This middleware also handles a basic user&amp;rsquo;s cache to avoid unnecessary calls to &lt;em&gt;&lt;strong&gt;aura-authentication-api&lt;/strong&gt;&lt;/em&gt; with every user&amp;rsquo;s request.
This cache is implemented using bot &lt;a href=&#34;https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-concept-state?view=azure-bot-service-4.0&#34;&gt;UserState&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
