<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chinthaka Bandara</title>
    <description>The latest articles on DEV Community by Chinthaka Bandara (@chindara).</description>
    <link>https://dev.to/chindara</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F256882%2Fcbec22ca-b194-449f-a4d3-2dfc62cc9437.jpeg</url>
      <title>DEV Community: Chinthaka Bandara</title>
      <link>https://dev.to/chindara</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chindara"/>
    <language>en</language>
    <item>
      <title>Implementing Multi-Factor Authentication (MFA) in .NET Applications</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Tue, 21 Jan 2025 10:25:50 +0000</pubDate>
      <link>https://dev.to/chindara/implementing-multi-factor-authentication-mfa-in-net-applications-4j53</link>
      <guid>https://dev.to/chindara/implementing-multi-factor-authentication-mfa-in-net-applications-4j53</guid>
      <description>&lt;p&gt;Multi-Factor Authentication (MFA) is a crucial security measure designed to enhance our application's protection and reduce the chances of unauthorized access. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9i6nx7lounm0vaaz6rre.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9i6nx7lounm0vaaz6rre.png" alt="MFA Process" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article walks you through the steps to implement MFA in a .NET 8 application, focusing on Time-based One-Time Password (OTP) compatible with Google Authenticator and Microsoft Authenticator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working .NET Web API&lt;/li&gt;
&lt;li&gt;Google Authenticator or Microsoft Authenticator installed on your phone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Setting up&lt;/strong&gt;&lt;br&gt;
Install the following NuGet packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;dotnet&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;QRCoder&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;dotnet&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;OtpNet&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Adding TOTP Service&lt;/strong&gt;&lt;br&gt;
This service will generate the secret Key for each user, generate QR codes, and validate OTP&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;OtpNet&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;QRCoder&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;MFA&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TotpService&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;GenerateSecretKey&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;secretKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;KeyGeneration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GenerateRandomKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Base32Encoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;GenerateQrCodeUrl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;issuer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EscapeDataString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"yourAppName"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;userEmail&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EscapeDataString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;$"otpauth://totp/&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;issuer&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;userEmail&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;?secret=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;issuer=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;issuer&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;algorithm=SHA1&amp;amp;digits=6&amp;amp;period=30"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;GenerateQRCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;var&lt;/span&gt; &lt;span class="n"&gt;qrGenerator&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;QRCodeGenerator&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;var&lt;/span&gt; &lt;span class="n"&gt;qrCodeData&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;qrGenerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;CreateQrCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;QRCodeGenerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ECCLevel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Q&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;var&lt;/span&gt; &lt;span class="n"&gt;qrCode&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;PngByteQRCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qrCodeData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;qrCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetGraphic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;ValidateOTP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;otp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;totp&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Totp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Base32Encoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;totp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;VerifyTotp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;otp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;VerificationWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RfcSpecifiedNetworkDelay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Integration TOTP Service into application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;User Registration&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When registering a user, generate a secret key and a QR code. The secret key should be saved with the user's information in the database, and the QR Code should be displayed to the user. &lt;/li&gt;
&lt;li&gt;Using this QR users can register using either Google Authenticator or Microsoft Authenticator. &lt;/li&gt;
&lt;li&gt;As a best practice do not keep the 'secretKey' in clear text format. Encrypt this value.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;secretKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_totpService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GenerateSecretKey&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_totpService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GenerateQrCodeUrl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"chinthakapb@gmail.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secretKey&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;qrCodeImage&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_totpService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GenerateQRCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Validating OTP&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the user logs into the application, provide a place for the user to enter the Time-based OTP generated from either Google Authenticator or Microsoft Authenticator. &lt;/li&gt;
&lt;li&gt;Get the 'secretKey' from the database and validate the OTP from the backend.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_totpService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ValidateOTP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SecretKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code will return whether the OTP is valid is not. You can use this to navigate the user into the system or not.&lt;/p&gt;

&lt;p&gt;Happy Coding 😀&lt;/p&gt;

</description>
      <category>mfa</category>
      <category>dotnet</category>
      <category>security</category>
    </item>
    <item>
      <title>How to map colors &amp; labels in ApexChart</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Wed, 15 May 2024 06:47:39 +0000</pubDate>
      <link>https://dev.to/chindara/apexchart-map-colors-to-labels-h3g</link>
      <guid>https://dev.to/chindara/apexchart-map-colors-to-labels-h3g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
When using a donut/pie chart it is mapping the colors in the array to labels in the label order. If there is no value for a particular label, then the whole thing gets messed up. This is a big issue when presenting data that doesn't always come in a predefined order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br&gt;
When passing data from the API, pass the colors also in the same order as labels. This way colors of missing labels won't be in the colors array. You have to send the color codes in Hex (#ffffff) format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chartOptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;chartData&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;labels&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
    &lt;span class="na"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;chartData&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Chart&lt;/span&gt; 
    &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;chartOptions&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
    &lt;span class="nx"&gt;series&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;chartData&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;series&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[]}&lt;/span&gt; 
    &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;donut&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; 
    &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Happy Coding 😉&lt;/p&gt;

</description>
      <category>react</category>
      <category>apexchart</category>
      <category>javascript</category>
      <category>chart</category>
    </item>
    <item>
      <title>PowerShell Script Not Digitally Signed</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Tue, 17 Oct 2023 08:25:10 +0000</pubDate>
      <link>https://dev.to/chindara/powershell-script-not-digitally-signed-2b3f</link>
      <guid>https://dev.to/chindara/powershell-script-not-digitally-signed-2b3f</guid>
      <description>&lt;p&gt;When you run a PowerShell script you might get the message saying “xxxx.ps1 is not digitally signed. The script will not execute on the system.”&lt;/p&gt;

&lt;p&gt;To fix this issue we have to bypass the PowerShell's execution policy. The following command will do that.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Execution policy Bypass&lt;/code&gt;&lt;br&gt;
This means Nothing is blocked and there are no warnings or prompts.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Scope Process&lt;/code&gt;&lt;br&gt;
This means only affects the current PowerShell session. The execution policy is saved in the environment variable &lt;code&gt;$env:PSExecutionPolicyPreference&lt;/code&gt;, rather than the registry. When the PowerShell session is closed, the variable and value are deleted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://go.microsoft.com/fwlink/?LinkID=135170"&gt;For more information check this article from Microsoft&lt;/a&gt; &lt;/p&gt;

</description>
      <category>microsoft</category>
      <category>powershell</category>
    </item>
    <item>
      <title>Node Version Manager</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Tue, 20 Dec 2022 04:39:24 +0000</pubDate>
      <link>https://dev.to/chindara/node-version-manager-47bb</link>
      <guid>https://dev.to/chindara/node-version-manager-47bb</guid>
      <description>&lt;p&gt;Sometimes when you are working as a developer you will have to work on multiple projects or fix up a bug in a old project. All these projects will not have the same &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;node.js&lt;/a&gt; version. Then you had to re-install &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;node.js&lt;/a&gt; according to the project. This will be a hassle when you had to switch between &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;node.js&lt;/a&gt; versions multiple times.&lt;/p&gt;

&lt;p&gt;nvm is a version manager for &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;node.js&lt;/a&gt;, designed to be installed per-user. nvm works on these platforms: unix, macOS, and windows WSL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;First we have to download and install &lt;a href="https://github.com/coreybutler/nvm-windows" rel="noopener noreferrer"&gt;nvm-windows&lt;/a&gt;. &lt;br&gt;
&lt;a href="https://github.com/coreybutler/nvm-windows/releases/tag/1.1.11" rel="noopener noreferrer"&gt;https://github.com/coreybutler/nvm-windows/releases/tag/1.1.11&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Check nvm version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List locally installed versions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install specific version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm &lt;span class="nb"&gt;install &lt;/span&gt;v18.12.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uninstall specific version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm uninstall 14.17.6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use specific version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvm use 18.12.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using these commands we can easily navigate across multiple &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;node.js&lt;/a&gt; versions&lt;/p&gt;

&lt;p&gt;Happy Coding 😉&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>css</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>SonarQube + Docker + .NET Core Code Analysis</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Wed, 13 Jul 2022 10:13:49 +0000</pubDate>
      <link>https://dev.to/chindara/sonarqube-docker-net-core-code-analysis-44</link>
      <guid>https://dev.to/chindara/sonarqube-docker-net-core-code-analysis-44</guid>
      <description>&lt;p&gt;Writing quality code plays a vital role in the software development life cycle. There are few tools to help us to write cleaner code. &lt;a href="https://www.sonarqube.org/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt; is one of the tools which has a free community version.&lt;br&gt;
&lt;a href="https://www.sonarqube.org/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt; performs various analyzes, bugs, code smells, test coverage, vulnerabilities, duplicate blocks.&lt;/p&gt;
&lt;h4&gt;
  
  
  Install SonarQube on Docker
&lt;/h4&gt;

&lt;p&gt;Let's now install the &lt;a href="https://www.sonarqube.org/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt; on docker desktop. You should have &lt;a href="https://www.docker.com/products/docker-desktop/" rel="noopener noreferrer"&gt;Docker Desktop&lt;/a&gt; installed &amp;amp; logged in. Run this command on command prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull sonarqube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have to do the port mapping&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --name Sonarqube --publish 192.168.4.176:9000:9000 sonarqube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the followings with your values&lt;br&gt;
&lt;strong&gt;Sonarqube&lt;/strong&gt; - Name of the containter (Sonarqube)&lt;br&gt;
&lt;strong&gt;192.168.4.176&lt;/strong&gt; - IP Address of the PC&lt;br&gt;
&lt;strong&gt;9000&lt;/strong&gt; - Port that we are going to map&lt;/p&gt;

&lt;p&gt;once the installation completes, Open your browser &amp;amp; go to &lt;u&gt;&lt;a href="http://localhost:9000" rel="noopener noreferrer"&gt;http://localhost:9000&lt;/a&gt;&lt;/u&gt;, it will prompts you to change the "admin" password. After that you will be directed to &lt;a href="https://www.sonarqube.org/" rel="noopener noreferrer"&gt;SonarQube&lt;/a&gt; home page.&lt;/p&gt;
&lt;h4&gt;
  
  
  Install SonarScanner for .NET Core Global Tool
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet tool install --global dotnet-sonarscanner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Create a project in SonarQube
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0e46n5amsxlz7o1t7yfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0e46n5amsxlz7o1t7yfs.png" alt="Image description" width="800" height="545"&gt;&lt;/a&gt; click on the "Manually" option &amp;amp; on the next screen provide name &amp;amp; key for the project. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6respz0npk59hmm7b9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6respz0npk59hmm7b9t.png" alt="Create project" width="446" height="405"&gt;&lt;/a&gt;In this article we will go with a local repository. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0ugnintkvcikjsbx07f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0ugnintkvcikjsbx07f.png" alt="Image description" width="800" height="658"&gt;&lt;/a&gt;Provide a name for the token &amp;amp; press "Generate" button. Once token is generated press on "Continue" button to run analysis on your project.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwsr646bi1sznylefv0k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjwsr646bi1sznylefv0k.png" alt="Image description" width="563" height="387"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Run analysis on your project
&lt;/h4&gt;

&lt;p&gt;Select ".NET" as the build type &amp;amp; ".NET Core" as the build tool.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4974e8r2ouivpzmt8r0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4974e8r2ouivpzmt8r0f.png" alt="Image description" width="800" height="586"&gt;&lt;/a&gt;Go to the root folder of your .NET Core project solution &amp;amp; open a command prompt from it. Now we can run the commands provided in the page one by one in the command prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet sonarscanner begin /k:"DemoProject" /d:sonar.host.url="http://localhost:9000"  /d:sonar.login="sqp_4f474d2d735dec2daa03b382cfde19ddc59cb18c"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet sonarscanner end /d:sonar.login="sqp_4f474d2d735dec2daa03b382cfde19ddc59cb18c"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;make sure to save these commands to re-run the code analysis.&lt;br&gt;
Once the last commands completes the page will be automatically refreshed with the report.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzbygdgs5qugfjsfo6rj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzbygdgs5qugfjsfo6rj.png" alt="Image description" width="800" height="978"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding 😀&lt;/p&gt;

</description>
      <category>sonarqube</category>
      <category>docker</category>
      <category>dotnet</category>
      <category>codeanalysis</category>
    </item>
    <item>
      <title>Tenant App Catalog vs Site Collection App Catalog in SharePoint Online</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Fri, 20 May 2022 08:16:25 +0000</pubDate>
      <link>https://dev.to/chindara/tenant-app-catalog-vs-site-collection-app-catalog-in-sharepoint-online-22bj</link>
      <guid>https://dev.to/chindara/tenant-app-catalog-vs-site-collection-app-catalog-in-sharepoint-online-22bj</guid>
      <description>&lt;p&gt;Tenant App Catalog in SharePoint Online is the central place for managing all your SharePoint Apps/add-ins and SPFx solutions. The deployed packages are visible to all site collections. &lt;br&gt;
With the introduction of Site Collection App Catalogs, tenant administrators can enable app catalogs in selected sites. Once enabled site collection admin can deploy packaged into that particular site collection. &lt;/p&gt;

&lt;p&gt;Let’s compare the Tenant App Catalog &amp;amp; Site Collection App Catalogs&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Tenant App Catalog&lt;/th&gt;
&lt;th&gt;Site Collection App Catalog&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Availability&lt;/td&gt;
&lt;td&gt;All the sites in the tenant&lt;/td&gt;
&lt;td&gt;Only selected site collection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who can deploy&lt;/td&gt;
&lt;td&gt;Tenant Administrator&lt;/td&gt;
&lt;td&gt;Site Collection Administrator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;When to use&lt;/td&gt;
&lt;td&gt;- Manage the apps centrally&lt;br&gt;- Have apps available globally&lt;/td&gt;
&lt;td&gt;- Try-out apps&lt;br&gt;- Apps are specific to a site collection&lt;br&gt;- Developing an App and want to make sure that app is only available in a specific site&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Limitations&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Configure and manage using the SharePoint Online Management Shell&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Tenant Administrator has the option to verify all the apps being deployed&lt;/td&gt;
&lt;td&gt;Site Collection Administrator has the option to verify all the apps being deployed. Although solutions installed, can be used only in a particular site, they can potentially access resources from other sites in the tenant&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Enable Site Collection App Catalog&lt;/strong&gt;&lt;br&gt;
Run the following commands in "SharePoint Online Management Shell"&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Connect-SPOService -Url https://&amp;lt;site name&amp;gt;-admin.sharepoint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When prompt enter your tenant administrator credentials &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Add-SPOSiteCollectionAppCatalog -Site https://&amp;lt;site name&amp;gt;.sharepoint.com/sites/DemoAppCatalog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will create a App Catalog in "DemoAppCatalog" site as shown in the below image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YcbHFS51--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ky0zhomjnn70splcgqay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YcbHFS51--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ky0zhomjnn70splcgqay.png" alt="Site Collection App Catalog" width="856" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploy Apps into Site Collection App Catalog&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Site Contents page of the Site Collection you have enabled app catalog&lt;/li&gt;
&lt;li&gt;Click on the “Apps for SharePoint” list&lt;/li&gt;
&lt;li&gt;Upload your custom solution .sppkg or .app file to the library&lt;/li&gt;
&lt;li&gt;If its a .sppkg, You’ll get a prompt asking if you trust the solution and if you would like to “Make this solution available to all sites in the organization”. Make sure to check this option and then click Deploy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Disable Site Collection App Catalog&lt;/strong&gt;&lt;br&gt;
Run the following commands in "SharePoint Online Management Shell"&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Connect-SPOService -Url https://&amp;lt;site name&amp;gt;-admin.sharepoint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When prompt enter your tenant administrator credentials &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Remove-SPOSiteCollectionAppCatalog -Site https://&amp;lt;site name&amp;gt;.sharepoint.com/sites/DemoAppCatalog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After executing this script, the Apps for SharePoint library will be still visible in your site collection, but you will not be able to deploy or use any solutions deployed in it.&lt;/p&gt;

&lt;p&gt;Happy Coding 😉&lt;/p&gt;

</description>
      <category>sharepoint</category>
      <category>spfx</category>
    </item>
    <item>
      <title>Install Oracle 12C with Docker</title>
      <dc:creator>Chinthaka Bandara</dc:creator>
      <pubDate>Mon, 27 Sep 2021 10:37:04 +0000</pubDate>
      <link>https://dev.to/chindara/install-oracle-12c-with-docker-55h7</link>
      <guid>https://dev.to/chindara/install-oracle-12c-with-docker-55h7</guid>
      <description>&lt;p&gt;Installing oracle database is a very tedious task. But with the help of Docker Containers, it can be easily done. With this solution, it gives developers the flexibility to work with multiple databases without the hassle.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Docker Installation&lt;/li&gt;
&lt;li&gt;Docker Hub Account&lt;/li&gt;
&lt;li&gt;Oracle Account (for downloading SQL Developer)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Head into &lt;a href="https://hub.docker.com/_/oracle-database-enterprise-edition"&gt;Oracle Database Enterprise Edition&lt;/a&gt; &amp;amp; agree to terms &amp;amp; conditions. &lt;/p&gt;

&lt;h4&gt;
  
  
  Installation
&lt;/h4&gt;

&lt;p&gt;Open Windows Terminal &amp;amp; run the following commands&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to Docker Hub
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Download Oracle Image
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull store/oracle/database-enterprise:12.2.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run Image
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d -p 1521:1521 --name oracle store/oracle/database-enterprise:12.2.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Connect to container
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker exec -it oracle bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the above command executes it will connect you to the SQL Plus terminal. Execute following commands to create the user to work on&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connect sys as sysdba;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above command will prompt you to enter the password. Enter &lt;strong&gt;Oradoc_db1&lt;/strong&gt; as default password&lt;/p&gt;

&lt;p&gt;Next, run the below commands one by one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alter session set "_ORACLE_SCRIPT"=true;
create user &amp;lt;username&amp;gt; identified by &amp;lt;password&amp;gt;;
GRANT ALL PRIVILEGES TO &amp;lt;username&amp;gt;;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can connect to the above created Oracle schema using &lt;a href="https://www.oracle.com/database/technologies/appdev/sqldeveloper-landing.html"&gt;Oracle SQL Developer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the following values when login&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Username&lt;/td&gt;
&lt;td&gt;entered user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password&lt;/td&gt;
&lt;td&gt;entered password&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hostname&lt;/td&gt;
&lt;td&gt;localhost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Port&lt;/td&gt;
&lt;td&gt;1521&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service Name&lt;/td&gt;
&lt;td&gt;ORCLCDB.localdomain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Happy Coding 😀&lt;/p&gt;

</description>
      <category>docker</category>
      <category>container</category>
      <category>oracle</category>
      <category>database</category>
    </item>
  </channel>
</rss>
