<?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: DKForge</title>
    <description>The latest articles on DEV Community by DKForge (@dkforge).</description>
    <link>https://dev.to/dkforge</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%2F3810758%2Fd84800d4-08dd-4952-b636-9718e2a5b081.png</url>
      <title>DEV Community: DKForge</title>
      <link>https://dev.to/dkforge</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dkforge"/>
    <language>en</language>
    <item>
      <title>How SSH Actually Works (Step-by-Step for Developers)</title>
      <dc:creator>DKForge</dc:creator>
      <pubDate>Sat, 04 Apr 2026 08:49:13 +0000</pubDate>
      <link>https://dev.to/dkforge/how-ssh-actually-works-step-by-step-for-developers-3bb9</link>
      <guid>https://dev.to/dkforge/how-ssh-actually-works-step-by-step-for-developers-3bb9</guid>
      <description>&lt;p&gt;Most developers use SSH every day:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh user@server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…but very few know what’s actually happening under the hood.&lt;/p&gt;

&lt;p&gt;Let’s break it down 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 1. TCP Connection
&lt;/h2&gt;

&lt;p&gt;Everything starts with a basic TCP connection between client and server.&lt;/p&gt;

&lt;p&gt;At this stage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No encryption yet
&lt;/li&gt;
&lt;li&gt;Just a raw connection
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🤝 2. Negotiation Phase
&lt;/h2&gt;

&lt;p&gt;The client and server exchange:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH protocol versions
&lt;/li&gt;
&lt;li&gt;Supported encryption algorithms
&lt;/li&gt;
&lt;li&gt;Key exchange methods
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They agree on a secure configuration before continuing.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔑 3. Session Key Generation
&lt;/h2&gt;

&lt;p&gt;SSH uses a key exchange algorithm (e.g. Diffie-Hellman) to generate a shared &lt;strong&gt;session key&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client -------- Key Exchange -------- Server
         -&amp;gt; shared secret key &amp;lt;-
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;👉 This session key is used for encrypting all communication.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔐 4. Authentication (Public Key)
&lt;/h2&gt;

&lt;p&gt;If you're using SSH keys:&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate SSH key
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"your_email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Copy public key to server
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-copy-id user@server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Or manually:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 The server checks if your public key exists there.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ 5. Verification
&lt;/h2&gt;

&lt;p&gt;The server sends an encrypted challenge.&lt;/p&gt;

&lt;p&gt;The client decrypts it using its &lt;strong&gt;private key&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;👉 If successful → authentication is complete.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔄 6. Encrypted Communication
&lt;/h2&gt;

&lt;p&gt;Now everything is encrypted using the session key:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commands
&lt;/li&gt;
&lt;li&gt;Responses
&lt;/li&gt;
&lt;li&gt;Data
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;👉 Sent encrypted → executed → returned encrypted&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ 7. Command Execution Flow
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client -&amp;gt; (encrypted command) -&amp;gt; Server
Server -&amp;gt; (execute command)
Server -&amp;gt; (encrypted response) -&amp;gt; Client
Client -&amp;gt; (decrypt response)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  🌐 Bonus: SSH Tunneling (Port Forwarding)
&lt;/h2&gt;

&lt;p&gt;SSH can create secure tunnels.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-L&lt;/span&gt; 3000:localhost:5432 user@remote-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Now you can connect to the remote DB via:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧠 Why SSH Is So Powerful
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Uses &lt;strong&gt;asymmetric cryptography&lt;/strong&gt; (public/private keys)
&lt;/li&gt;
&lt;li&gt;Establishes a fast &lt;strong&gt;symmetric session key&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Protects against eavesdropping and MITM attacks
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔐 Best Practices
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Disable password authentication (server-side)&lt;/span&gt;
PasswordAuthentication no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Set correct permissions&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;700 ~/.ssh
&lt;span class="nb"&gt;chmod &lt;/span&gt;600 ~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use SSH agent&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;ssh-agent &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
ssh-add ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💭 Question
&lt;/h2&gt;

&lt;p&gt;Do you use password authentication or SSH keys in your setup?&lt;/p&gt;

</description>
      <category>linux</category>
      <category>networking</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Things I Learned While Building Custom Keycloak Themes</title>
      <dc:creator>DKForge</dc:creator>
      <pubDate>Sat, 14 Mar 2026 17:50:20 +0000</pubDate>
      <link>https://dev.to/dkforge/things-i-learned-while-building-custom-keycloak-themes-of3</link>
      <guid>https://dev.to/dkforge/things-i-learned-while-building-custom-keycloak-themes-of3</guid>
      <description>&lt;p&gt;Keycloak’s theme system looks simple at first, but once you start building custom login experiences you quickly discover a few non-obvious things.&lt;/p&gt;

&lt;p&gt;Customizing authentication UIs is often necessary when integrating Keycloak into a product where branding and user experience matter.&lt;/p&gt;

&lt;p&gt;After experimenting with several custom Keycloak themes, here are a few practical things I learned while customizing the authentication UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Most UI customization happens in just a few files
&lt;/h2&gt;

&lt;p&gt;At first I expected Keycloak theming to require modifying many templates, but in practice most UI changes happen in just a few places.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight fluent"&gt;&lt;code&gt;&lt;span class="no"&gt;login&lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;template.ftl&lt;span class="w"&gt;
  &lt;/span&gt;login.ftl&lt;span class="w"&gt;
  &lt;/span&gt;theme.properties&lt;span class="w"&gt;
  &lt;/span&gt;resources/css/&lt;span class="err"&gt;*&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;template.ftl&lt;/code&gt; file is particularly important because it defines the layout used across multiple pages.&lt;/p&gt;

&lt;p&gt;Once you customize that file, changes automatically apply to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login&lt;/li&gt;
&lt;li&gt;register&lt;/li&gt;
&lt;li&gt;reset password&lt;/li&gt;
&lt;li&gt;verification flows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it easier to build a consistent authentication UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. CSS overrides are usually safer than modifying templates
&lt;/h2&gt;

&lt;p&gt;A common temptation when customizing Keycloak is editing the FreeMarker templates directly.&lt;/p&gt;

&lt;p&gt;However, in many cases you can achieve the same result by simply overriding CSS classes.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.kc-button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;135deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;#00d9ff&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;#0099cc&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;14px&lt;/span&gt; &lt;span class="m"&gt;32px&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;This approach keeps templates cleaner and makes theme maintenance easier when upgrading Keycloak.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Email templates behave very differently from login pages
&lt;/h2&gt;

&lt;p&gt;One thing that surprised me while working on themes was how different email templates are compared to login pages.&lt;/p&gt;

&lt;p&gt;Modern CSS features often don’t work consistently in email clients.&lt;/p&gt;

&lt;p&gt;For example, gradients may require fallback colors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;background&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="err"&gt;#00&lt;/span&gt;&lt;span class="nt"&gt;d9ff&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;background&lt;/span&gt;&lt;span class="nd"&gt;:linear-gradient&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;135&lt;/span&gt;&lt;span class="nt"&gt;deg&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="err"&gt;#00&lt;/span&gt;&lt;span class="nt"&gt;d9ff&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="err"&gt;#0099&lt;/span&gt;&lt;span class="nt"&gt;cc&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Many email clients also ignore transitions or hover effects, so email templates should be designed with progressive enhancement in mind.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Previewing themes locally saves a lot of time
&lt;/h2&gt;

&lt;p&gt;Testing authentication flows manually can be slow.&lt;/p&gt;

&lt;p&gt;Using a local Keycloak instance (for example with Docker) makes it much easier to test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login flows&lt;/li&gt;
&lt;li&gt;password reset&lt;/li&gt;
&lt;li&gt;email verification&lt;/li&gt;
&lt;li&gt;OTP flows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Being able to quickly restart Keycloak and reload the theme speeds up development significantly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example: Custom Login UI
&lt;/h2&gt;

&lt;p&gt;While experimenting with Keycloak themes, I wanted to see how far the default login experience could be customized.&lt;/p&gt;

&lt;p&gt;Below is a comparison between the default Keycloak login page and two custom themes built using the theme system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default Keycloak login&lt;/strong&gt;&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%2F5bvh6mmfwjwwgfzs2hya.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%2F5bvh6mmfwjwwgfzs2hya.png" alt="Default Keycloak Login Page" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom Login theme – FutureMax style&lt;/strong&gt;&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%2Fpb1g5n8r7qz80g41lz38.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%2Fpb1g5n8r7qz80g41lz38.png" alt="Keycloak Custom Login Page - FutureMax" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom Login Theme - Business style&lt;/strong&gt;&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%2F5sjsswkalxjgn9gjprlp.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%2F5sjsswkalxjgn9gjprlp.png" alt="Keycloak Custom Login Page - Business" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even though the visual design changes completely, the underlying authentication flow remains exactly the same.&lt;br&gt;
The theme system only affects the presentation layer while Keycloak continues to handle authentication, sessions and security.&lt;/p&gt;

&lt;p&gt;For reference, I published the Business theme here as an example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub repository:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/dkforge31/dkforge-keycloak-business-theme-free" rel="noopener noreferrer"&gt;DKForge Business Theme For Keycloak&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repository shows a basic Keycloak theme structure and how the login UI can be customized through FreeMarker templates and CSS.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Keycloak’s theme system allows developers to completely customize the authentication interface without changing the underlying authentication logic.&lt;/p&gt;

&lt;p&gt;By modifying FreeMarker templates and overriding styles, it’s possible to transform the default login UI into a fully branded experience that fits the product.&lt;/p&gt;

&lt;p&gt;Even small UI changes can significantly improve the overall authentication experience while still relying on Keycloak’s secure authentication flows.&lt;/p&gt;




</description>
      <category>keycloak</category>
      <category>authentication</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>Enabling HTTPS on an Application Server using Keytool</title>
      <dc:creator>DKForge</dc:creator>
      <pubDate>Sat, 14 Mar 2026 08:32:28 +0000</pubDate>
      <link>https://dev.to/dkforge/enabling-https-on-an-application-server-using-keytool-22bf</link>
      <guid>https://dev.to/dkforge/enabling-https-on-an-application-server-using-keytool-22bf</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;This guide explains how to configure HTTPS (SSL/TLS) for an application server using a certificate issued by a Certificate Authority (CA) and the Java keytool utility.&lt;/p&gt;

&lt;p&gt;The process includes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; Creating a keystore and generating a private key&lt;br&gt;
&lt;strong&gt;2)&lt;/strong&gt; Generating a Certificate Signing Request (CSR)&lt;br&gt;
&lt;strong&gt;3)&lt;/strong&gt; Importing signed certificates from the Certificate Authority&lt;br&gt;
&lt;strong&gt;4)&lt;/strong&gt; Configuring the application server to use the keystore&lt;br&gt;
&lt;strong&gt;5)&lt;/strong&gt; Testing the HTTPS connection&lt;/p&gt;

&lt;p&gt;⚠️ The exact configuration of the application server may vary depending on the server software being used.&lt;br&gt;
Always verify SSL configuration compatibility with your specific application server.&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Create a Keystore and Private Key
&lt;/h2&gt;

&lt;p&gt;Use the Java keytool utility to create a keystore and generate a key pair.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-genkeypair&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;key_alias&amp;gt; &lt;span class="nt"&gt;-keyalg&lt;/span&gt; RSA &lt;span class="nt"&gt;-keysize&lt;/span&gt; 2048 &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt; &lt;span class="nt"&gt;-validity&lt;/span&gt; 365
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Paramaters explanation
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-genkeypair&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates a new key pair (private key + self-signed certificate).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-alias &amp;lt;key_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unique name identifying the key inside the keystore. This alias will later be used by the application server to locate the private key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-keyalg RSA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Specifies the encryption algorithm used for the key pair. RSA is commonly used for SSL certificates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-keysize 2048&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Defines the key size in bits. 2048 is a common secure size.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-keystore &amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The name of the keystore file that will be created. The keystore stores private keys and certificates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-validity 365&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Defines how long the generated certificate will remain valid (in days).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;During execution, the command will prompt you for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keystore password&lt;/li&gt;
&lt;li&gt;Organization details&lt;/li&gt;
&lt;li&gt;Common Name (CN)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Common Name (CN) must match the fully qualified domain name (FQDN) of the server.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;api.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Generate a Certificate Signing Request (CSR)
&lt;/h2&gt;

&lt;p&gt;The CSR is sent to the Certificate Authority to issue a trusted certificate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-certreq&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;key_alias&amp;gt; &lt;span class="nt"&gt;-file&lt;/span&gt; &amp;lt;csr_file&amp;gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters explanation
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-certreq&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generates a certificate signing request.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-alias &amp;lt;key_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The alias of the private key that the CSR will be generated for.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-file &amp;lt;csr_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Output CSR file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-keystore &amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The keystore containing the private key.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The resulting file should be sent to the Certificate Authority (CA).&lt;/p&gt;

&lt;p&gt;The CA typically returns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server certificate&lt;/li&gt;
&lt;li&gt;Intermediate certificate(s)&lt;/li&gt;
&lt;li&gt;Root certificate&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Import Certificates into the Keystore
&lt;/h2&gt;

&lt;p&gt;Certificates must be imported in the correct order to form a valid certificate chain.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.1 Import the Root Certificate
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-import&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;root_alias&amp;gt; &lt;span class="nt"&gt;-file&lt;/span&gt; &amp;lt;root_certificate&amp;gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;root_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias name for the root certificate entry.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;root_certificate&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Root certificate file provided by the CA.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The keystore where the certificate will be stored.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3.2 Import the Intermediate Certificate
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-import&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;intermediate_alias&amp;gt; &lt;span class="nt"&gt;-file&lt;/span&gt; &amp;lt;intermediate_certificate&amp;gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;intermediate_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias name for the intermediate CA certificate.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;intermediate_certificate&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Intermediate certificate file provided by the CA.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Target keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3.3 Import the Server Certificate
&lt;/h2&gt;

&lt;p&gt;The server certificate must be imported using the same alias as the private key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-import&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;key_alias&amp;gt; &lt;span class="nt"&gt;-file&lt;/span&gt; &amp;lt;server_certificate&amp;gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;key_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias of the private key created in Step 1.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;server_certificate&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Signed certificate returned by the Certificate Authority.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Target keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  4. Verify the Certificate Chain
&lt;/h2&gt;

&lt;p&gt;After importing the certificates, verify that the certificate chain was created correctly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-list&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;-alias&lt;/span&gt; &amp;lt;key_alias&amp;gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-list&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists the entries stored in the keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays detailed certificate information.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;key_alias&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias of the private key entry.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;keystore_file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Target keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Expected result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Entry &lt;span class="nb"&gt;type&lt;/span&gt;: PrivateKeyEntry
Certificate chain length: 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Typical certificate chain order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Certificate[1] → Server Certificate
Certificate[2] → Intermediate CA
Certificate[3] → Root CA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5.Configure the Application Server
&lt;/h2&gt;

&lt;p&gt;The keystore must be referenced in the server's SSL configuration.&lt;/p&gt;

&lt;p&gt;Example generic configuration parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;SSL Enabled: &lt;span class="nb"&gt;true
&lt;/span&gt;HTTPS Port: 8443
Keystore File: &amp;lt;path_to_keystore&amp;gt;
Keystore Password: &amp;lt;keystore_password&amp;gt;
Key Alias: &amp;lt;key_alias&amp;gt;
SSL Protocol: TLS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ The exact configuration syntax depends on the application server.&lt;br&gt;
Consult the server documentation to verify the correct SSL configuration method.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example: HTTPS Configuration using a Java Keystore (Tomcat server.xml)
&lt;/h3&gt;

&lt;p&gt;The following example demonstrates how an HTTPS connector may be configured in a server that uses a Java keystore.&lt;/p&gt;

&lt;p&gt;⚠️ This is only an example configuration.&lt;br&gt;
Different application servers use different configuration formats.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Example HTTP connector --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;Connector&lt;/span&gt; &lt;span class="na"&gt;port=&lt;/span&gt;&lt;span class="s"&gt;"8080"&lt;/span&gt;
           &lt;span class="na"&gt;protocol=&lt;/span&gt;&lt;span class="s"&gt;"HTTP/1.1"&lt;/span&gt;
           &lt;span class="na"&gt;connectionTimeout=&lt;/span&gt;&lt;span class="s"&gt;"20000"&lt;/span&gt;
           &lt;span class="na"&gt;redirectPort=&lt;/span&gt;&lt;span class="s"&gt;"8443"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Example HTTPS connector --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;Connector&lt;/span&gt; &lt;span class="na"&gt;protocol=&lt;/span&gt;&lt;span class="s"&gt;"org.apache.coyote.http11.Http11NioProtocol"&lt;/span&gt;
           &lt;span class="na"&gt;port=&lt;/span&gt;&lt;span class="s"&gt;"8443"&lt;/span&gt;
           &lt;span class="na"&gt;maxThreads=&lt;/span&gt;&lt;span class="s"&gt;"200"&lt;/span&gt;
           &lt;span class="na"&gt;scheme=&lt;/span&gt;&lt;span class="s"&gt;"https"&lt;/span&gt;
           &lt;span class="na"&gt;secure=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
           &lt;span class="na"&gt;SSLEnabled=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
           &lt;span class="na"&gt;keystoreFile=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;path_to_keystore&amp;gt;"&lt;/span&gt;
           &lt;span class="na"&gt;keystorePass=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;keystore_password&amp;gt;"&lt;/span&gt;
           &lt;span class="na"&gt;keyAlias=&lt;/span&gt;&lt;span class="s"&gt;"&amp;lt;key_alias&amp;gt;"&lt;/span&gt;
           &lt;span class="na"&gt;clientAuth=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt;
           &lt;span class="na"&gt;sslProtocol=&lt;/span&gt;&lt;span class="s"&gt;"TLS"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Optional AJP connector --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;Connector&lt;/span&gt; &lt;span class="na"&gt;port=&lt;/span&gt;&lt;span class="s"&gt;"8009"&lt;/span&gt;
           &lt;span class="na"&gt;protocol=&lt;/span&gt;&lt;span class="s"&gt;"AJP/1.3"&lt;/span&gt;
           &lt;span class="na"&gt;redirectPort=&lt;/span&gt;&lt;span class="s"&gt;"8443"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Explanation of Configuration Parameters
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;port&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Port used by the HTTPS connector (commonly 8443).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;protocol&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTP protocol implementation used by the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SSLEnabled&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enables SSL/TLS encryption.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scheme="https"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates that the connector handles HTTPS traffic.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;secure="true"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Marks the connection as secure.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;keystoreFile&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Path to the Java keystore containing the server certificate and private key.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;keystorePass&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Password used to access the keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;keyAlias&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias of the private key stored in the keystore.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sslProtocol&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Defines the TLS protocol used for encrypted communication.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clientAuth&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates whether client certificate authentication is required.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Placholder Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;path_to_keystore&amp;gt;  → /opt/app/security/server_keystore.jks
&amp;lt;keystore_password&amp;gt; → changeit
&amp;lt;key_alias&amp;gt;         → server-cert
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6.Restart the Application Server
&lt;/h2&gt;

&lt;p&gt;Restart the server to apply the new HTTPS configuration.&lt;/p&gt;

&lt;p&gt;Check the server logs for SSL initialization messages.&lt;/p&gt;

&lt;p&gt;Typical log example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Initializing HTTPS connector
Starting SSL listener
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  7.Test HTTPS Connectivity
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Test using curl
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-vk&lt;/span&gt; https://&amp;lt;server_hostname&amp;gt;:&amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enables verbose output.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Allows insecure SSL connections (useful for testing).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;server_hostname&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hostname or FQDN of the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;port&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTPS port configured on the server.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Different keystore format
&lt;/h3&gt;

&lt;p&gt;Occurs when the server expects a different keystore format.&lt;/p&gt;

&lt;p&gt;Possible causes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;PKCS12 keystore used where JKS is expected&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Corrupted keystore file&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verify keystore type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;keytool &lt;span class="nt"&gt;-list&lt;/span&gt; &lt;span class="nt"&gt;-keystore&lt;/span&gt; &amp;lt;keystore_file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Certificate chain length = 1
&lt;/h3&gt;

&lt;p&gt;This means the server certificate was imported without the CA certificates.&lt;/p&gt;

&lt;p&gt;Solution:&lt;/p&gt;

&lt;p&gt;Import certificates in this order:&lt;/p&gt;

&lt;p&gt;1) Root CA&lt;/p&gt;

&lt;p&gt;2) Intermediate CA&lt;/p&gt;

&lt;p&gt;3) Server certificate&lt;/p&gt;

&lt;h3&gt;
  
  
  Alias mismatch
&lt;/h3&gt;

&lt;p&gt;If the server cannot locate the private key, the alias configured in the server must match the alias used during keystore creation.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Key Alias: &amp;lt;key_alias&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;HTTPS configuration generally includes the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a keystore and private key&lt;/li&gt;
&lt;li&gt;Generate a CSR&lt;/li&gt;
&lt;li&gt;Obtain certificates from a Certificate Authority&lt;/li&gt;
&lt;li&gt;Import certificates into the keystore&lt;/li&gt;
&lt;li&gt;Verify the certificate chain&lt;/li&gt;
&lt;li&gt;Configure the application server to use the keystore&lt;/li&gt;
&lt;li&gt;Restart the server&lt;/li&gt;
&lt;li&gt;Test the HTTPS endpoint&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>java</category>
      <category>security</category>
      <category>ssl</category>
      <category>devops</category>
    </item>
    <item>
      <title>OAuth2 vs OpenID Connect: What's the Difference?</title>
      <dc:creator>DKForge</dc:creator>
      <pubDate>Sat, 07 Mar 2026 16:22:12 +0000</pubDate>
      <link>https://dev.to/dkforge/oauth2-vs-openid-connect-whats-the-difference-3af5</link>
      <guid>https://dev.to/dkforge/oauth2-vs-openid-connect-whats-the-difference-3af5</guid>
      <description>&lt;p&gt;OAuth2 and OpenID Connect are often mentioned together, and many developers assume they solve the same problem.&lt;/p&gt;

&lt;p&gt;In reality, they serve &lt;strong&gt;different purposes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Understanding the difference is essential when designing authentication and authorization systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  What OAuth2 Actually Is
&lt;/h2&gt;

&lt;p&gt;OAuth2 is an &lt;strong&gt;authorization framework&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It allows an application to access resources on behalf of a user &lt;strong&gt;without sharing the user's credentials&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of sending a username and password to every service, the client receives an &lt;strong&gt;access token&lt;/strong&gt; issued by an &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That token can then be used to request resources from a &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Example scenario:&lt;/p&gt;

&lt;p&gt;A user allows a third-party application to access their data stored in another service.&lt;/p&gt;

&lt;p&gt;OAuth2 enables this delegation securely.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why OAuth2 Is Not Authentication
&lt;/h2&gt;

&lt;p&gt;A common misconception is that OAuth2 is used for authentication.&lt;/p&gt;

&lt;p&gt;OAuth2 does &lt;strong&gt;not&lt;/strong&gt; tell an application &lt;strong&gt;who the user is&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It only answers the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Is this client allowed to access this resource?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An access token proves that the client has permission, but it does not provide reliable identity information about the user.&lt;/p&gt;

&lt;p&gt;Because of this limitation, OAuth2 alone is &lt;strong&gt;not sufficient for authentication&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What OpenID Connect Adds
&lt;/h2&gt;

&lt;p&gt;OpenID Connect (OIDC) is a &lt;strong&gt;layer built on top of OAuth2&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It adds the missing piece: &lt;strong&gt;authentication&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;OIDC introduces a new token type called the &lt;strong&gt;ID Token&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The ID Token contains identity information about the authenticated user, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User identifier&lt;/li&gt;
&lt;li&gt;Issuer&lt;/li&gt;
&lt;li&gt;Authentication time&lt;/li&gt;
&lt;li&gt;Token expiration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows the client application to confirm &lt;strong&gt;who the user is&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In other words:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OAuth2&lt;/td&gt;
&lt;td&gt;Authorization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenID Connect&lt;/td&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  ID Token vs Access Token
&lt;/h2&gt;

&lt;p&gt;Understanding the difference between these two tokens is important.&lt;/p&gt;

&lt;h3&gt;
  
  
  Access Token
&lt;/h3&gt;

&lt;p&gt;Used to access protected resources.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;GET /api/user-data
Authorization: Bearer access_token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resource server validates the token and returns the requested data.&lt;/p&gt;




&lt;h3&gt;
  
  
  ID Token
&lt;/h3&gt;

&lt;p&gt;Used to &lt;strong&gt;identify the authenticated user&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The client application can inspect the token to obtain identity information.&lt;/p&gt;

&lt;p&gt;Typical fields in an ID Token include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sub&lt;/code&gt; (user identifier)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;iss&lt;/code&gt; (issuer)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aud&lt;/code&gt; (audience)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;exp&lt;/code&gt; (expiration time)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ID Tokens are commonly implemented as &lt;strong&gt;JWT tokens&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real Example Flow
&lt;/h2&gt;

&lt;p&gt;A simplified OpenID Connect flow looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user attempts to log in to an application.&lt;/li&gt;
&lt;li&gt;The application redirects the user to an &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The user authenticates (login, MFA, etc.).&lt;/li&gt;
&lt;li&gt;The Authorization Server issues:

&lt;ul&gt;
&lt;li&gt;an &lt;strong&gt;Access Token&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;an &lt;strong&gt;ID Token&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The application uses the &lt;strong&gt;ID Token&lt;/strong&gt; to identify the user.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Access Token&lt;/strong&gt; is used to request data from APIs.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;OAuth2 and OpenID Connect work together but serve different roles.&lt;/p&gt;

&lt;p&gt;OAuth2 provides &lt;strong&gt;authorization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;OpenID Connect provides &lt;strong&gt;authentication&lt;/strong&gt; by adding identity information on top of OAuth2.&lt;/p&gt;

&lt;p&gt;Understanding this distinction helps developers design secure and scalable authentication systems.&lt;/p&gt;




&lt;p&gt;If you want to understand the different OAuth2 flows in detail, you can read my previous article:&lt;/p&gt;

&lt;p&gt;Understanding OAuth2 Grant Types&lt;br&gt;&lt;br&gt;
&lt;a href="https://dev.to/dkforge/understanding-oauth2-grant-types-50p8"&gt;https://dev.to/dkforge/understanding-oauth2-grant-types-50p8&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>oauth2</category>
      <category>oidc</category>
      <category>security</category>
    </item>
    <item>
      <title>Understanding OAuth2 Grant Types</title>
      <dc:creator>DKForge</dc:creator>
      <pubDate>Sat, 07 Mar 2026 01:12:35 +0000</pubDate>
      <link>https://dev.to/dkforge/understanding-oauth2-grant-types-50p8</link>
      <guid>https://dev.to/dkforge/understanding-oauth2-grant-types-50p8</guid>
      <description>&lt;p&gt;OAuth2 is one of the most widely used authorization frameworks in modern applications.&lt;/p&gt;

&lt;p&gt;However, many developers struggle to understand when to use each grant type and how the flows actually work.&lt;/p&gt;

&lt;p&gt;In this guide we break down the most common OAuth2 grant types with diagrams and practical explanations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Overview of OAuth2&lt;/li&gt;
&lt;li&gt;What is a Grant Type?&lt;/li&gt;
&lt;li&gt;
Grant Types

&lt;ul&gt;
&lt;li&gt;Authorization Code Grant&lt;/li&gt;
&lt;li&gt;Implicit Grant&lt;/li&gt;
&lt;li&gt;Resource Owner Password Credentials Grant&lt;/li&gt;
&lt;li&gt;Client Credentials Grant&lt;/li&gt;
&lt;li&gt;Refresh Token Grant&lt;/li&gt;
&lt;li&gt;Device Authorization Grant&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Overview of OAuth2
&lt;/h2&gt;

&lt;p&gt;OAuth2 is designed to provide a secure way for applications to obtain access to user data without requiring the user to share their credentials. Instead, it uses &lt;strong&gt;access tokens&lt;/strong&gt; issued by an &lt;strong&gt;Authorization Server&lt;/strong&gt; to allow applications to request data from a &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Grant Type?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;grant type&lt;/strong&gt; in OAuth2 is a method by which a client application obtains an access token. It defines the flow that an application follows to request and receive authorization from an authorization server. Different grant types exist to accommodate various security needs and application types.&lt;/p&gt;




&lt;h2&gt;
  
  
  Grant Types
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Authorization Code Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
  actor User
  participant Browser
  participant App Server
  participant Authorization Server
  participant Resource Server

  User -&amp;gt;&amp;gt; Browser: 
  Browser -&amp;gt;&amp;gt; App Server: GET/index.html
  App Server --&amp;gt;&amp;gt; Authorization Server: Redirect to Authorization Server
  Authorization Server -&amp;gt;&amp;gt; Browser: Display Login Page
  Browser -&amp;gt;&amp;gt; Authorization Server: Enters Credentials(username,password)
  Authorization Server -&amp;gt;&amp;gt; Authorization Server: User Authentication
  Authorization Server --&amp;gt;&amp;gt; App Server: Redirect back to app wihth grant code(auth code)
  App Server -&amp;gt;&amp;gt; Authorization Server: get tokens by sending the grant code(auth code)
  Authorization Server -&amp;gt;&amp;gt; App Server: return access token
  App Server -&amp;gt;&amp;gt; Resource Server: get data sending the token
  Resource Server-&amp;gt;&amp;gt;App Server:return data
  App Server-&amp;gt;&amp;gt;Browser:display data/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fcg76d8uphv0hw6af4tv1.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%2Fcg76d8uphv0hw6af4tv1.png" alt="Authorization Code Grant" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Authorization Code Grant&lt;/strong&gt; is used by web applications and follows a redirection-based flow to obtain an access token securely.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The user accesses a web application and is redirected to an &lt;strong&gt;Authorization Server&lt;/strong&gt; for authentication.&lt;/li&gt;
&lt;li&gt;The user logs in, and if successful, the Authorization Server redirects back to the application with an &lt;strong&gt;authorization code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The application exchanges this authorization code for an &lt;strong&gt;access token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The access token is then used to request protected resources from the &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Implicit Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
  actor User
  participant Browser
  participant App Server
  participant Authorization Server
  participant Resource Server

  User -&amp;gt;&amp;gt; Browser: 
  Browser -&amp;gt;&amp;gt; App Server: GET/index.html
  App Server --&amp;gt;&amp;gt; Authorization Server: Redirect or popup to Authorization Server
  Authorization Server -&amp;gt;&amp;gt; Browser: Display Login Page
  Browser -&amp;gt;&amp;gt; Authorization Server: Enters Credentials(username,password)
  Authorization Server -&amp;gt;&amp;gt; Authorization Server: User Authentication/Credentials validated
  Authorization Server --&amp;gt;&amp;gt; App Server: Redirect back to app with access token in the URL
  App Server--&amp;gt;&amp;gt;Browser:Token
  Browser -&amp;gt;&amp;gt; Resource Server: get data sending the token
  Resource Server-&amp;gt;&amp;gt;Browser:return data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fsaoivqbs9t5mym089ygj.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%2Fsaoivqbs9t5mym089ygj.png" alt="Implicit Grant" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Implicit Grant&lt;/strong&gt; is used for single-page applications (SPAs) where storing client secrets securely is not possible. It directly provides an access token.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The user is redirected to the &lt;strong&gt;Authorization Server&lt;/strong&gt;, logs in, and approves access.&lt;/li&gt;
&lt;li&gt;Instead of returning an authorization code, the Authorization Server directly returns an &lt;strong&gt;access token&lt;/strong&gt; in the URL.&lt;/li&gt;
&lt;li&gt;The client application uses this token to access the &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;⚠️ Note: The Implicit Grant is now considered deprecated in OAuth 2.1 and modern applications should use the Authorization Code flow with PKCE instead.&lt;/p&gt;




&lt;h3&gt;
  
  
  Resource Owner Password Credentials Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
  actor User
  participant Browser
  participant App Server
  participant Authorization Server
  participant Resource Server

  User -&amp;gt;&amp;gt; Browser: 
  Browser -&amp;gt;&amp;gt; App Server: GET/index.html
  App Server -&amp;gt;&amp;gt; Browser: Display Login page
  Browser -&amp;gt;&amp;gt; App Server: User Credentials
  App Server -&amp;gt;&amp;gt; Authorization Server: Get tokens sending User Credentials
  Authorization Server -&amp;gt;&amp;gt; App Server: Access Token
  App Server -&amp;gt;&amp;gt; Resource Server: Get data sending the token
  Resource Server-&amp;gt;&amp;gt;App Server:Return data
  App Server-&amp;gt;&amp;gt;Browser: index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F5myatzro2cb2tkpendql.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%2F5myatzro2cb2tkpendql.png" alt="Resource Owner Password Credentials Grant" width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Used when the application is &lt;strong&gt;trusted&lt;/strong&gt;, and the user directly provides their credentials to the client application.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The user enters their credentials directly into the application.&lt;/li&gt;
&lt;li&gt;The application sends these credentials to the &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If valid, the Authorization Server responds with an &lt;strong&gt;access token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The application uses the access token to request data from the &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Client Credentials Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
  participant App Server
  participant Authorization Server
  participant Resource Server

  App Server -&amp;gt;&amp;gt; Authorization Server: Get tokens sending Client Credentials(client_id,client secret)
  Authorization Server -&amp;gt;&amp;gt; App Server: Access Token
  App Server -&amp;gt;&amp;gt; Resource Server: Get data sending the token
  Resource Server-&amp;gt;&amp;gt;App Server:Return data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fihbd7ukgbzmde916orxz.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%2Fihbd7ukgbzmde916orxz.png" alt="Client Credentials Grant" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Used when a client application needs to access its own resources without user intervention.&lt;/p&gt;

&lt;h4&gt;
  
  
  Explanation
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The application sends its &lt;strong&gt;client ID and secret&lt;/strong&gt; to the &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If valid, the Authorization Server responds with an &lt;strong&gt;access token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The application uses the token to access the &lt;strong&gt;Resource Server&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Refresh Token Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    actor User
    participant ClientApplication
    participant AuthorizationServer
    participant ResourceServer

    User-&amp;gt;&amp;gt;ClientApplication: Initiates login
    ClientApplication-&amp;gt;&amp;gt;AuthorizationServer: Redirects to authorization endpoint
    AuthorizationServer-&amp;gt;&amp;gt;User: Prompts for authentication
    User-&amp;gt;&amp;gt;AuthorizationServer: Provides credentials
    AuthorizationServer--&amp;gt;&amp;gt;ClientApplication: Returns authorization code
    ClientApplication-&amp;gt;&amp;gt;AuthorizationServer: Exchanges authorization code for tokens (access token + refresh token)
    AuthorizationServer--&amp;gt;&amp;gt;ClientApplication: Returns access token and refresh token

    ClientApplication-&amp;gt;&amp;gt;ResourceServer: Uses access token to access resources
    ResourceServer--&amp;gt;&amp;gt;ClientApplication: Returns requested resources

    Note over ClientApplication,AuthorizationServer: Access token expires
    ClientApplication-&amp;gt;&amp;gt;AuthorizationServer: Requests new access token using refresh token
    AuthorizationServer--&amp;gt;&amp;gt;ClientApplication: Returns new access token (and optionally a new refresh token)

    ClientApplication-&amp;gt;&amp;gt;ResourceServer: Uses new access token to access resources
    ResourceServer--&amp;gt;&amp;gt;ClientApplication: Returns requested resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fm0hlc2snjtokzfaeld21.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%2Fm0hlc2snjtokzfaeld21.png" alt="Refresh Token Grant" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Allows clients to obtain a &lt;strong&gt;new access token&lt;/strong&gt; using a refresh token without requiring user intervention.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The client application initially receives both an &lt;strong&gt;access token&lt;/strong&gt; and a &lt;strong&gt;refresh token&lt;/strong&gt; after a successful authentication process using a grant type(e.g. Authorization Code grant).&lt;/li&gt;
&lt;li&gt;The client uses the &lt;strong&gt;access token&lt;/strong&gt; to request protected resources.&lt;/li&gt;
&lt;li&gt;When the &lt;strong&gt;access token&lt;/strong&gt; expires,  the client sends the &lt;strong&gt;refresh token&lt;/strong&gt; to the &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If the &lt;strong&gt;refresh token&lt;/strong&gt; is valid, the Authorization Server returns a new &lt;strong&gt;access token&lt;/strong&gt; (and optionally a new &lt;strong&gt;refresh token&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;The client continues using the new access token to access resources.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Device Authorization Grant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    actor User 
    participant Device
    participant AuthorizationServer
    participant ClientApplication

    User-&amp;gt;&amp;gt;Device: Initiates device authorization
    Device-&amp;gt;&amp;gt;AuthorizationServer: Request device authorization
    AuthorizationServer--&amp;gt;&amp;gt;Device: Returns device code and user code
    Device--&amp;gt;&amp;gt;User: Displays user code and verification URI

    User-&amp;gt;&amp;gt;AuthorizationServer: Navigates to verification URI and enters user code
    AuthorizationServer-&amp;gt;&amp;gt;User: Prompts user to authorize the device
    User-&amp;gt;&amp;gt;AuthorizationServer: Authorizes the device

    AuthorizationServer-&amp;gt;&amp;gt;Device: Polling for authorization status
    Device-&amp;gt;&amp;gt;AuthorizationServer: Polling request with device code
    AuthorizationServer--&amp;gt;&amp;gt;Device: Returns access token (if authorized)

    Device-&amp;gt;&amp;gt;ClientApplication: Uses access token to access resources
    ClientApplication--&amp;gt;&amp;gt;Device: Returns requested resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F7w5tsq7ju60mm4ahx9tt.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%2F7w5tsq7ju60mm4ahx9tt.png" alt="Device Authorization Grant" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Used for devices with limited input capabilities, such as smart TVs and IoT devices.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;The user initiates the device authorization.&lt;/li&gt;
&lt;li&gt;The device requests authorization from the &lt;strong&gt;Authorization Server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The Authorization Server returns a &lt;strong&gt;device code&lt;/strong&gt; and a &lt;strong&gt;user code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The device displays the &lt;strong&gt;user code&lt;/strong&gt; and &lt;strong&gt;verification URI&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The user navigates to the verification URI and enters the &lt;strong&gt;user code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The Authorization Server prompts the user to authorize the device.&lt;/li&gt;
&lt;li&gt;Once approved, the device polls the Authorization Server for the access token.&lt;/li&gt;
&lt;li&gt;The Authorization Server issues an &lt;strong&gt;access token&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;OAuth2 provides multiple grant types to support different application architectures.&lt;/p&gt;

&lt;p&gt;Choosing the correct flow depends on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security requirements&lt;/li&gt;
&lt;li&gt;Client type (web, mobile, server-to-server)&lt;/li&gt;
&lt;li&gt;User interaction needs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In modern architectures the most commonly used flows are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authorization Code + PKCE&lt;/li&gt;
&lt;li&gt;Client Credentials&lt;/li&gt;
&lt;li&gt;Refresh Token&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these flows helps developers design secure authentication and authorization systems.&lt;/p&gt;




</description>
      <category>oauth2</category>
      <category>webdev</category>
      <category>security</category>
      <category>authentication</category>
    </item>
  </channel>
</rss>
