<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Development on David Lang</title>
    <link>https://www.davidlang.tech/tags/development/</link>
    <description>Recent content in Development on David Lang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sun, 05 Feb 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.davidlang.tech/tags/development/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Security - Authentication Workflows</title>
      <link>https://www.davidlang.tech/posts/security-application-authentication-workflows/</link>
      <pubDate>Sun, 05 Feb 2023 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/security-application-authentication-workflows/</guid>
      <description>&lt;p&gt;Here are three scenarios for implementing authentication workflows.&lt;/p&gt;&#xA;&lt;h2 id=&#34;internet-applications-public-facing&#34;&gt;Internet Applications (Public facing)&lt;/h2&gt;&#xA;&lt;p&gt;For internet web applications and APIs, Session based (SessionID cookie) and Token Based (JWT) Authentication can be implemented.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Session Based:&lt;/strong&gt; Implemented for a majority of traditional and stateful web applications. Once the user is authenticated, A Session state is created and stored in an external State server or SQL database. The Session state is identified by a unique SessionID. This SessionID is returned to the client and set as a cookie using &lt;code&gt;Set-Cookie: sessionid=38askse24d56dh43hrs7a8; HttpOnly; Path=/&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using React Hooks - useState and useEffect</title>
      <link>https://www.davidlang.tech/posts/using-reactjs-hooks-introduction-usestate-useeffect/</link>
      <pubDate>Tue, 15 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/using-reactjs-hooks-introduction-usestate-useeffect/</guid>
      <description>&lt;p&gt;With the release of &lt;a href=&#34;https://reactjs.org/docs/hooks-intro.html&#34; title=&#34;React Hooks&#34;&gt;Hooks&lt;/a&gt; in React 16.8, it is now possible to store &lt;strong&gt;state&lt;/strong&gt; in a &lt;strong&gt;function&lt;/strong&gt;. We can add react features like useState and useEffect into the function directly without needing to create &lt;strong&gt;class&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;usestate&#34;&gt;useState&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;strong&gt;useState&lt;/strong&gt; hook adds state to the functional components. useState hook allows you to declare one state variable at a time.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-react&#34; data-lang=&#34;react&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;import&lt;/span&gt; React, { useState } from &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;react&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;function&lt;/span&gt; Counter() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#586e75&#34;&gt;//Declare the &amp;#34;counter&amp;#34; state variable&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; [counter, setCounter] &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; useState(&lt;span style=&#34;color:#2aa198&#34;&gt;0&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#719e07&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;p&lt;/span&gt;&amp;gt;Clicked {counter} times&amp;lt;/&lt;span style=&#34;color:#268bd2&#34;&gt;p&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#586e75&#34;&gt;//increment the counter by 1 on every click&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;button&lt;/span&gt; onClick&lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt;{() =&amp;gt; setCounter(counter &lt;span style=&#34;color:#719e07&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#2aa198&#34;&gt;1&lt;/span&gt;)}&amp;gt;Click here&amp;lt;/&lt;span style=&#34;color:#268bd2&#34;&gt;button&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/&lt;span style=&#34;color:#268bd2&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;useeffect&#34;&gt;useEffect&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;strong&gt;useEffect&lt;/strong&gt; allows to manage side effects in a functional component. Some of the examples are fetching external data using api, manipulating DOM in react. It is similar to componentDidMount and componentDidUpdate from class component.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
