<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohammad Jafar AlYasfo on Medium]]></title>
        <description><![CDATA[Stories by Mohammad Jafar AlYasfo on Medium]]></description>
        <link>https://medium.com/@mohammadalyasfo?source=rss-69fbeb539494------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2oJ1ot4v3guSLXrb</url>
            <title>Stories by Mohammad Jafar AlYasfo on Medium</title>
            <link>https://medium.com/@mohammadalyasfo?source=rss-69fbeb539494------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:17:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammadalyasfo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Local Dev to Production: How to Deploy AI Models in 2025]]></title>
            <link>https://medium.com/@mohammadalyasfo/from-local-dev-to-production-how-to-deploy-ai-models-in-2025-5e536b9f82dc?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e536b9f82dc</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai-infrastructure]]></category>
            <category><![CDATA[data-sovereignty]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 19:53:49 GMT</pubDate>
            <atom:updated>2025-07-13T19:53:49.756Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1rv4gwBSKQtI-gZ_COuZ5w.png" /></figure><blockquote><strong>AI models </strong>are more accessible than ever, but taking one from your local machine to production — whether on-premises or in the cloud — requires thoughtful decisions. Here’s a practical guide based on real-world deployments and lessons learned.</blockquote><h3>Getting Started: Playing with Local LLMs</h3><p>Most developers start by testing models on their local machines. Tools like <strong>Ollama</strong>, <strong>Open WebUI</strong>, or custom scripts make it easy to run models like <strong>LLaMA 3</strong> without much setup. These tools help you chat with models, build early demos, or wrap them in lightweight applications.</p><p>What’s even better: many of these tools now follow the <strong>OpenAI API standard</strong>, making it simple to switch from a local setup to the cloud. You can start building your app locally and plug into cloud models later — without rewriting your code.</p><h3>The Real Challenge: From Local to Production</h3><p>Once your model works locally, the big question becomes: <strong>Where do you deploy it?</strong> In 2025, you typically have three main options:</p><h3>1. On-Premise (Self-Managed Servers)</h3><p>Think: servers under your desk or racks in a private data center. This setup is often required by companies in regions like the <strong>UAE or Saudi Arabia</strong> that have strict <strong>data sovereignty laws</strong>. You get full control, but must manage everything: networking, access, scaling, and security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*RTV4qJQmCFg3w21H" /><figcaption>AI Deployment Environments: On-Premises</figcaption></figure><h3>2. Public Cloud (AWS, Azure, GCP, etc.)</h3><p>Cloud providers let you spin up machines instantly, attach GPUs, and scale with ease. However, you may face challenges like vendor lock-in or privacy concerns depending on your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*O8w3jlRiIBJSgjMF" /><figcaption>AI Deployment Environments: Cloud</figcaption></figure><h3>3. Hybrid Setup</h3><p>Often the most practical option. Run stateless services (like APIs) in the cloud, but keep sensitive data or specific AI workloads on-premises — connected securely via VPN. This provides both flexibility and compliance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*SPahxhfoN_5ESWsq" /><figcaption>AI Deployment Environments: Hybrid</figcaption></figure><h3>Use Case Spotlight: Smart Mattress Co. AI Assistant</h3><p>Let’s make this real with a simple example.</p><p>Imagine a fictional company called <strong>Smart Mattress Co.</strong> They want to improve customer support by using a chatbot to answer questions about returns, product issues, and how to set up smart mattress features.</p><p>Here’s how this works in the real world:</p><ol><li>A customer sends a message through the website or app.</li><li>That message is received by the company’s server or backend system.</li><li>The system forwards it to an AI model to generate a response.</li><li>If needed, the model can pull extra info from a product database or customer records.</li></ol><p>Depending on data privacy requirements, the model could run in the cloud or on the company’s internal servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*MstoP6RgoL0db18J" /><figcaption>Chat Assistant Use Case: Smart Mattress Company</figcaption></figure><h3>API Inference: More Than Just Wrapping a Model</h3><p>Exposing a model through an API may seem easy — but it’s more than just writing a Flask app and hitting <em>“run.”</em></p><p>You need to think about:</p><ul><li><strong>Security</strong> (authentication &amp; token access).</li><li><strong>Rate Limiting</strong> (to prevent overload).</li><li><strong>Concurrency Management</strong> (AI models can’t process multiple requests like typical REST APIs).</li><li><strong>Monitoring &amp; Logging</strong> (especially for debugging inference timeouts).</li></ul><p>Poor API design can result in major issues, such as a model might silently fail when too many users send requests simultaneously.</p><h3>Packaging &amp; Deployment Strategies</h3><p>Once your model is ready, packaging it properly is key to smooth deployment.</p><p>Common tips:</p><ul><li>Use <strong>Docker</strong> to bundle the model and app.</li><li>Choose <strong>lightweight base images</strong> to reduce container size.</li><li>Consider <strong>quantizing</strong> the model to reduce its size and speed up inference.</li></ul><p>But Docker isn’t the only option anymore. Tools like:</p><ul><li><strong>Kickstart/KServe </strong>(from CNCF) for model serving in Kubernetes,</li><li><strong>Docker Model Runner</strong> which supports OCI artifacts, not just containers,</li><li><strong>Modal/RunPod</strong> and similar platforms for abstracted inference via clean APIs</li></ul><p>…all aim to simplify and streamline how models move from development to production.</p><h3>Google Cloud Vertex AI: A Cloud-Based Option</h3><p>Google Cloud’s <strong>Vertex AI</strong> offers a flexible approach to deploy models at scale. Here’s what it includes:</p><ul><li><strong>Model Garden</strong> with models from Google, Hugging Face, and other partners</li><li><strong>Fully-managed endpoints</strong> or custom container deployment options</li><li><strong>Cloud Run</strong> support for <strong>serverless inference</strong> with GPU access — pay only when requests are made.</li></ul><p>This is an excellent choice if you want to avoid managing infrastructure but still need performance and scalability.</p><h3>CI/CD for AI: What a Real Deployment Pipeline Looks Like</h3><p>Here’s what a typical modern deployment pipeline for AI models might look like:</p><ol><li><strong>Local Development</strong><br> Build and test using tools like Ollama, PyTorch, or Transformers.</li><li><strong>CI/CD Pipeline (Build Server)</strong><br>Use tools like GitHub Actions or GitLab CI to package your app and model into a Docker image or OCI artifact.</li><li><strong>Model Store / Registry</strong><br> Push the image to an artifact registry (like Docker Hub or Google Artifact Registry).</li><li><strong>Deployment</strong>:</li></ol><ul><li>Pull the latest image or artifact.</li><li>Deploy to Kubernetes, Cloud Run, or your on-prem server.</li><li>Expose via an API or app UI (like Open WebUI or a custom frontend).</li></ul><h3>Final Thoughts</h3><p><strong>AI deployment</strong> is no longer just something for data scientists — it’s now a key part of infrastructure and product engineering.</p><p>Whether you’re building something for a smart mattress company or scaling AI across a large business, you’ll need to:</p><ul><li>Understand the deployment environment</li><li>Secure your endpoints</li><li>Optimize your packaging</li><li>Use the right tools for flexibility and speed</li></ul><p>2025 is all about <strong>deployment flexibility</strong>, <strong>data control</strong>, and <strong>performance at scale</strong>. If you can bridge the gap between local testing and real-world usage, you’re already ahead of the curve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e536b9f82dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step-by-Step Guide: Migrating Your Website from a VM to Azure Web Apps]]></title>
            <link>https://medium.com/@mohammadalyasfo/step-by-step-guide-migrating-your-website-from-a-vm-to-azure-web-apps-7fbc73856ca0?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fbc73856ca0</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[azure-app-service]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Mon, 07 Apr 2025 06:19:35 GMT</pubDate>
            <atom:updated>2025-04-07T12:00:24.908Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*dzBTU7yOcjn8lh9MSZdxXQ.png" /><figcaption>Migrate a Website from a Virtual Machine to Azure Web Apps</figcaption></figure><h3>Introduction</h3><p>Are you looking to move your web application from a Virtual Machine (VM) to <strong>Azure Web Apps</strong>? If so, you’re in the right place! Migrating to <strong>Azure App Service</strong> can make your website more scalable, secure, and easier to manage. Instead of dealing with VM maintenance, updates, and manual configurations, you can take advantage of <strong>Azure’s fully managed hosting</strong> for your web applications.</p><p>This guide walks you through the process using the <strong>Azure App Service Migration Assistant</strong> tool, providing step-by-step instructions to ensure a smooth transition.</p><h3>Step 1: Install the App Service Migration Assistant</h3><p>To begin, we need to install the <strong>Azure App Service Migration Assistant</strong>, a tool that helps analyze and migrate web applications from a VM to <strong>Azure Web Apps</strong>.</p><h4>Download and Install the Migration Assistant</h4><ol><li><strong>Open the Azure portal</strong> by going to <a href="https://portal.azure.com/">https://portal.azure.com</a>.</li><li>In the <strong>search bar at the top</strong>, type <strong>Azure Migrate</strong> and select it from the results.</li><li>In the <strong>Azure Migrate</strong> dashboard, find the <strong>Migration goals</strong> section on the left-hand menu and click <strong>Web Apps</strong>.</li><li>Click the <strong>Create Project</strong> button to set up a new migration project.</li><li>In the project creation form, fill in the following details:</li></ol><ul><li><strong>Resource Group</strong>: Choose an existing resource group (this may have been pre-provisioned for your lab).</li><li><strong>Project Name</strong>: Enter testproject.</li><li><strong>Geography</strong>: Select the <strong>United Arab Emirates</strong>.</li></ul><p>6. Click <strong>Create</strong> to set up the migration project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J64GdyCX25wxBrqcqMW9-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLmDv59QsoHGrZBADofBEQ.png" /></figure><h4>Download the Migration Tool</h4><ol><li>Once your project is created, locate the <strong>Azure Migrate: Web App Migration</strong> section.</li><li>Click the hyperlink that says <strong>“Download the App Service Migration Assistant tool from here”</strong>.</li><li>When the page opens, <strong>copy the URL</strong> from your browser’s address bar.</li><li>Go back to your <strong>VM</strong>, open a web browser, and <strong>paste the copied link</strong> into the address bar.</li><li>On the download page, scroll to the <strong>App Service migration tools and resources</strong> section.</li><li>Under <strong>Migration Tools</strong>, click on <strong>App Service Migration Assistant</strong> to start the download.</li><li>Once the file is downloaded, locate AppServiceMigrationAssistant.msi and double-click it to begin the installation.</li><li>Follow the on-screen instructions to complete the installation.</li><li>Once installed, a shortcut for <strong>App Service Migration Assistant</strong> will appear on your desktop. <strong>Double-click</strong> it to open the tool.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2FmJKgnFGmq6sVNEzRBGw.png" /></figure><h3>Step 2: Migrate the Website</h3><p>Now that we have installed the <strong>App Service Migration Assistant</strong>, let’s configure it to migrate your website to Azure.</p><h4>Run the Migration Assistant</h4><ol><li>Open the <strong>Azure App Service Migration Assistant</strong>.</li><li>On the <strong>Choose a Site</strong> page, select <strong>Your Web Site</strong> and click <strong>Next</strong>.</li><li>The tool will now scan your website’s contents and settings. This process may take a few moments.</li><li>Once the scan is complete, an <strong>Assessment Report</strong> will appear. This report will categorize results under:</li></ol><ul><li><strong>Success</strong>: Components that can be migrated without issues.</li><li><strong>Warnings</strong>: Items that may require manual adjustments after migration.</li><li><strong>Errors</strong>: Components that cannot be migrated automatically.</li></ul><p>5. Review the report and take note of any warnings or errors before proceeding.</p><p>6. Click <strong>Next</strong> to move forward with the migration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eesxv8usLtC4KI_HCsSsJQ.png" /></figure><h4>Sign in to Azure</h4><ol><li>On the <strong>Login to Azure</strong> page, click <strong>Copy Code &amp; Open Browser</strong>.</li><li>A new browser tab will open with the <strong>Microsoft sign-in page</strong>.</li><li>Paste the copied code into the <strong>Enter Code</strong> field and click <strong>Next</strong>.</li><li>When prompted, select your <strong>Azure account</strong> (this should be the same one used to set up the migration project).</li><li>If asked, click <strong>Continue</strong> to allow the <strong>App Service Migration Assistant</strong> to access your Azure subscription.</li><li>Once authentication is complete, <strong>close the browser tab</strong> and return to the <strong>Migration Assistant</strong> tool.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MAlLjJacVYTIot82122vrg.png" /></figure><h4>Set Up the Azure Migration Options</h4><ol><li>In the <strong>Azure Migrate Hub</strong> page, locate the <strong>Azure Migrate Project</strong> drop-down and select testproject.</li><li>Click <strong>Next</strong> to proceed.</li><li>On the <strong>Azure Options</strong> page, configure the following settings:</li></ol><ul><li><strong>Subscription</strong>: Leave this as the default selection (your current lab subscription).</li><li><strong>Resource Group</strong>: Choose <strong>Use existing</strong> and select the resource group created earlier.</li><li><strong>Destination Site Name</strong>: Enter testwebsitexxx (replace xxx with a unique identifier).</li><li><strong>App Service Plan</strong>: Choose <strong>Use existing</strong>.</li><li><strong>Dedicated App Service Plan</strong>: Ensure that <strong>awesomeappserviceplan</strong> is selected.</li><li><strong>Databases</strong>: Keep <strong>Skip database setup</strong> selected (since we are not migrating a database in this guide).</li></ul><p>4. Click <strong>Migrate</strong> to begin the migration process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06jHrNbnbfMUPvU3dGpnGA.png" /></figure><h3>Step 3: Verify the Migration</h3><p>Once the migration is complete, let’s confirm that everything worked correctly.</p><h4>Test the Website on Azure</h4><ol><li>After the migration process finishes, you will see a <strong>Migration Results</strong> page.</li><li>Click the <strong>Go to your website</strong> button.</li><li>A new browser tab will open with your migrated website.</li><li>Verify the following:</li></ol><ul><li>The <strong>URL</strong> in the browser should match testwebsitexxx.azurewebsites.net.</li><li>Check your website pages and functionality to ensure everything is working as expected.</li></ul><p>If both of these checks are successful, then <strong>congratulations!</strong> Your website has been successfully migrated to Azure Web Apps!</p><h3>Conclusion</h3><p>You did it! You’ve successfully migrated a web application from a <strong>VM</strong> to <strong>Azure Web Apps</strong> using the <strong>Azure App Service Migration Assistant</strong>.</p><p>By moving your website to <strong>Azure</strong>, you now have a fully managed hosting environment that is <strong>scalable, secure, and easy to maintain</strong>. You no longer need to worry about <strong>manual server updates</strong> or <strong>downtime</strong> due to maintenance.</p><h3>What’s Next?</h3><p>Now that your website is running on <strong>Azure Web Apps</strong>, you can explore additional features such as:<br> ✅ <strong>Auto-scaling</strong> — Automatically adjust resources based on traffic.<br> ✅ <strong>Continuous Deployment</strong> — Integrate with GitHub, Azure DevOps, or Bitbucket.<br> ✅ <strong>Monitoring &amp; Alerts</strong> — Use <strong>Azure Application Insights</strong> to track performance and errors.</p><p>This is just the beginning of your cloud journey! Keep exploring <strong>Azure’s powerful tools</strong> and take your web applications to the next level.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fbc73856ca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cybersecurity: An Essential Responsibility for Software Engineers]]></title>
            <link>https://medium.com/@mohammadalyasfo/cybersecurity-an-essential-responsibility-for-software-engineers-2c147ffd9c0e?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c147ffd9c0e</guid>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[data-protection]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security-awareness]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Sat, 22 Mar 2025 11:28:15 GMT</pubDate>
            <atom:updated>2025-03-22T11:30:03.194Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ou-2mMdsa7se2w4o.jpg" /><figcaption>Cybersecurity: An Essential Responsibility for Software Engineers</figcaption></figure><p>In today’s digital-first world, software engineers do more than just write code — they are the frontline defenders of data security. Every line of code has the potential to either strengthen or weaken an application’s defenses.</p><p><strong>Cyber threats</strong> are evolving at an alarming pace, with hackers exploiting vulnerabilities in software to steal data, commit fraud, and disrupt businesses. A single security flaw can lead to devastating consequences: data breaches, financial losses, reputational damage, and even legal penalties.</p><p>Yet, many developers still treat cybersecurity as an afterthought. The reality? <strong>Security is not optional — it’s a fundamental responsibility.</strong></p><p>In this article, we’ll explore why <strong>cybersecurity </strong>should be ingrained in every software engineer’s mindset and provide <strong>practical strategies</strong> to build secure applications from day one.</p><h3>Why Cybersecurity Matters in Your Software Development</h3><h4>Protecting User Data</h4><p>Most applications handle sensitive information — personal details, payment data, or login credentials. A single vulnerability can expose this data to malicious actors, leading to identity theft, financial fraud, and legal repercussions.</p><h4>Maintaining User Trust</h4><p>Users expect their data to be safe. A security breach can destroy trust instantly, leading to lost customers, negative reviews, and long-term damage to your brand. Companies that prioritize security build stronger relationships with their users.</p><h4>Compliance with Regulations</h4><p>Global data protection laws — <strong>GDPR, HIPAA, CCPA</strong> — impose strict security requirements. Failing to meet these standards can result in <strong>hefty fines and legal trouble.</strong> As an engineer, understanding these regulations helps you develop compliant and legally sound software.</p><h4>Avoiding Financial Loss</h4><p>Cyberattacks aren’t just technical issues — they’re <strong>expensive.</strong> Ransomware attacks, data breaches, and system downtime can cost companies millions. Proactive security measures <strong>save money</strong> by preventing costly incidents.</p><h4>Staying Ahead of Cyber Threats</h4><p>Hackers are constantly discovering new ways to exploit weaknesses. By embedding security into your development process, you <strong>stay ahead of the game</strong>, making your applications harder to attack.</p><h3>Real-World Cybersecurity Challenges I’ve Faced</h3><p>Throughout my career, I’ve worked on security-focused projects that reinforced the importance of proactive cybersecurity. Here are two key experiences that shaped my approach:</p><h4>Fixing Vulnerabilities in Government Applications</h4><p>While working on a <strong>government web application in the UAE</strong>, my role was to <strong>identify and fix security vulnerabilities</strong> flagged by <a href="https://www.qualys.com/"><strong>Qualys</strong></a><strong>,</strong> a powerful security scanning tool. This process involved:</p><ul><li>Analyzing security reports</li><li>Pinpointing root causes of vulnerabilities</li><li>Implementing fixes to meet strict security standards</li></ul><p>This experience taught me the importance of <strong>continuous vulnerability assessment</strong> and how automated security tools can detect risks early.</p><h4>Securing a Cloud-Based Booking System with Cybersecurity Experts</h4><p>In a previous role, I collaborated with <strong>a cybersecurity specialist,</strong> to enhance the security of a <strong>cloud-based booking system and its underlying cloud architecture</strong>. Our focus was on:</p><ul><li><strong>Identifying and mitigating vulnerabilities</strong> in the web application to prevent attacks like SQL injection, XSS, and CSRF.</li><li><strong>Implementing secure cloud configurations</strong> to protect data storage, networking, and compute resources.</li><li><strong>Threat modeling</strong> to anticipate potential security risks in both the application and cloud infrastructure.</li><li><strong>Strengthening authentication and access controls</strong> to ensure secure communication between the web app and cloud services.</li><li><strong>Developing an incident response strategy</strong> to quickly detect and mitigate security breaches.</li></ul><p>This collaboration reinforced the importance of <strong>integrating security into both web development and cloud architecture</strong>, ensuring a robust defense against cyber threats.</p><h3>How to Integrate Cybersecurity into Your Development Workflow</h3><p>Security shouldn’t be an afterthought. <strong>It should be part of your daily development practices.</strong> Here are actionable steps you can take right now:</p><h4>1. Adopt a Security-First Mindset</h4><ul><li><strong>Think like a hacker.</strong> Always ask, <em>“How could someone break this?”</em></li><li><strong>Prioritize security</strong> at every development stage — from design to deployment.</li><li><strong>Make security non-negotiable</strong> in your team’s coding standards.</li></ul><h4>2. Follow Secure Coding Practices</h4><ul><li><strong>Validate and sanitize</strong> all user inputs to prevent injection attacks (e.g., SQL Injection, XSS).</li><li>Use <strong>parameterized queries</strong> to avoid SQL injection vulnerabilities.</li><li><strong>Never hardcode sensitive data</strong> (API keys, credentials). Use <strong>environment variables</strong> instead.</li></ul><h4>3. Implement Strong Authentication &amp; Authorization</h4><ul><li><strong>Use Multi-Factor Authentication (MFA)</strong> to strengthen user login security.</li><li>Implement <strong>Role-Based Access Control (RBAC)</strong> to restrict access to sensitive data.</li><li>Hash and salt passwords with <strong>bcrypt</strong> or <strong>Argon2</strong> (never store plaintext passwords!).</li></ul><h4>4. Encrypt Data at Every Stage</h4><ul><li>Use <strong>TLS/SSL</strong> to encrypt data in transit.</li><li>Store sensitive data <strong>encrypted at rest</strong> (e.g., AES-256).</li><li>Use secure hashing algorithms for passwords and sensitive data.</li></ul><h4>5. Keep Dependencies Up to Date</h4><ul><li>Regularly update libraries, frameworks, and third-party dependencies.</li><li>Use tools like <strong>Dependabot, Snyk, or OWASP Dependency-Check</strong> to detect security issues in dependencies.</li></ul><h4>6. Conduct Regular Security Audits</h4><ul><li><strong>Review your code for security vulnerabilities</strong> (manual reviews + automated tools).</li><li>Run <strong>static and dynamic analysis tools</strong> (e.g., SonarQube, Checkmarx).</li></ul><h4>7. Test for Vulnerabilities Using Security Tools</h4><ul><li>Use <strong>OWASP ZAP, Burp Suite, or Qualys</strong> to scan for security flaws.</li><li>Perform <strong>penetration testing</strong> to simulate real-world attacks and identify weak points.</li></ul><h4>8. Secure Your APIs</h4><ul><li><strong>Validate and sanitize</strong> API inputs and outputs.</li><li>Implement <strong>rate limiting</strong> to prevent abuse and DDoS attacks.</li><li>Use <strong>OAuth2, JWT, or API gateways</strong> for secure authentication.</li></ul><h4>9. Educate Your Team on Security Best Practices</h4><ul><li>Conduct <strong>regular security training</strong> for your development team.</li><li>Stay updated on <strong>emerging cyber threats</strong> and security trends.</li><li>Encourage a <strong>security-first culture</strong> within your organization.</li></ul><h4>10. Plan for Incident Response</h4><ul><li>Have a <strong>clear incident response plan</strong> in place to handle security breaches.</li><li>Monitor for suspicious activity using <strong>SIEM (Security Information and Event Management) tools.</strong></li><li>Regularly <strong>test and refine</strong> your security protocols.</li></ul><h3>Conclusion: Security is a Software Engineer’s Responsibility</h3><p>Cybersecurity isn’t just the responsibility of <strong>security teams</strong> — it’s <strong>your</strong> responsibility as a developer.</p><p>By embedding security into your workflow, you:<br> ✅ Protect user data from breaches<br> ✅ Build <strong>trust</strong> with your customers<br> ✅ Ensure compliance with regulations<br> ✅ Reduce financial and operational risks<br> ✅ Stay ahead of cyber threats</p><p>Start small: <strong>validate inputs, secure authentication, encrypt data, and test for vulnerabilities.</strong> Then, keep learning, refining, and evolving your security practices.</p><p>A secure application isn’t just a safer one — it’s a <strong>successful</strong> one.</p><h4>What security measures have you integrated into your development process? Share your insights in the comments!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c147ffd9c0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure Authentication System for Web APIs with Azure AD B2C and STS Integration]]></title>
            <link>https://medium.com/@mohammadalyasfo/building-a-secure-authentication-system-for-web-apis-with-azure-ad-b2c-and-sts-integration-6cb2a1aca100?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cb2a1aca100</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[openid-connect]]></category>
            <category><![CDATA[azure-security]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Tue, 18 Mar 2025 21:35:07 GMT</pubDate>
            <atom:updated>2025-03-18T22:13:19.603Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ycPWxNXHL7on6NAXNDQbRQ.png" /><figcaption>Azure Active Directory B2C</figcaption></figure><p>In today’s digital landscape, securing web APIs is paramount to protect sensitive data and ensure that only authorized users and services can access your application’s functionality. <strong>Azure Active Directory B2C (Azure AD B2C) </strong>is a powerful identity management service that simplifies user authentication and authorization. When combined with a <strong>Security Token Service (STS)</strong> application and integrated at the gateway level, you can build a robust, scalable, and secure authentication system for your web APIs.</p><p>In this article, we’ll walk through the process of building such a system, covering everything from basic setup to advanced security features and best practices. By the end, you’ll have a production-ready authentication system that leverages Azure AD B2C, an STS application, and an API Gateway.</p><h3>Why Use Azure AD B2C and STS?</h3><p><strong>Azure AD B2C</strong> is a cloud identity service that enables you to authenticate users using social, enterprise, or local accounts. It provides features like multi-factor authentication (MFA), custom policies, and seamless integration with your applications. However, to decouple authentication logic from your core application and centralize token management, you can use an STS application.</p><p><strong>An STS application</strong> acts as a dedicated service for issuing, validating, and refreshing tokens. By separating the STS from your Web API, you achieve better modularity, scalability, and security. Integrating the STS at the gateway level ensures that all incoming requests are authenticated before they reach your API.</p><h3>Prerequisites</h3><p>Before we begin, ensure you have the following:</p><ol><li><strong>Azure Subscription</strong>: To create and manage Azure AD B2C.</li><li><strong>Visual Studio or Visual Studio Code</strong>: For developing the Web API and STS application.</li><li><strong>.NET Core SDK</strong>: We’ll use .NET Core for building the Web API and STS application.</li><li><strong>Azure CLI</strong>: For managing Azure resources from the command line.</li></ol><h3>Step 1: Set Up Azure AD B2C</h3><h4>1.1 Create an Azure AD B2C Tenant</h4><ol><li>Log in to the <a href="https://portal.azure.com/">Azure Portal</a>.</li><li>Navigate to <strong>Create a resource</strong> and search for <strong>Azure Active Directory B2C</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Yt8zTmAMIeDtoEJ5m6a7w.jpeg" /><figcaption>Create Azure Active Directory B2C</figcaption></figure><ol><li>Click <strong>Create</strong> and follow the prompts to create a new Azure AD B2C tenant.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XY8uMDgRoidflTV68QvMw.jpeg" /><figcaption>Create a tenant</figcaption></figure><h4>1.2 Register the Web API Application</h4><ol><li>In the Azure AD B2C tenant, go to <strong>App registrations</strong> and click <strong>New registration</strong>.</li><li>Enter a name for your application (e.g., WebAPIApp).</li><li>Set the <strong>Redirect URI</strong> to the URL of your Web API (e.g., <a href="https://localhost:5001).">https://localhost:5001).</a></li><li>Click <strong>Register</strong>.</li><li>Note down the <strong>Application (client) ID</strong> and <strong>Directory (tenant) ID</strong> for later use.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pAiYoQf_v1NVrfommpRHSQ.jpeg" /></figure><h4>1.3 Register the STS Application</h4><ol><li>Repeat the registration process for the STS application (e.g., STSAuthApp).</li><li>Note down the <strong>Application (client) ID</strong> and <strong>Directory (tenant) ID</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udYxpl4YTHBj7wqaJPXYFQ.jpeg" /></figure><h4>1.4 Configure API Permissions</h4><ol><li>In the <strong>WebAPIApp</strong> registration, go to <strong>API permissions</strong> and click <strong>Add a permission</strong>.</li><li>Select <strong>My APIs</strong> and choose the <strong>STSAuthApp</strong>.</li><li>Select the appropriate permissions (e.g., user_impersonation).</li><li>Click <strong>Grant admin consent</strong>.</li></ol><h3>Step 2: Create the STS Application</h3><h4>2.1 Create a New .NET Core Project</h4><ol><li>Open Visual Studio or Visual Studio Code.</li><li>Create a new <strong>ASP.NET Core Web API</strong> project named STSAuthApp.</li></ol><h4>2.2 Install Required NuGet Packages</h4><p>Install the following NuGet packages:</p><pre>dotnet add package Microsoft.IdentityModel.Tokens<br>dotnet add package System.IdentityModel.Tokens.Jwt<br>dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer</pre><h4>2.3 Configure JWT Authentication</h4><p>In the Startup.cs file, configure JWT authentication:</p><pre>public void ConfigureServices(IServiceCollection services)<br>{<br>    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)<br>        .AddJwtBearer(options =&gt;<br>        {<br>            options.Authority = &quot;https://login.microsoftonline.com/{tenant-id}/v2.0&quot;;<br>            options.Audience = &quot;{client-id-of-STSAuthApp}&quot;;<br>        });<br><br>    services.AddControllers();<br>}<br><br>public void Configure(IApplicationBuilder app, IWebHostEnvironment env)<br>{<br>    if (env.IsDevelopment())<br>    {<br>        app.UseDeveloperExceptionPage();<br>    }<br><br>    app.UseRouting();<br><br>    app.UseAuthentication();<br>    app.UseAuthorization();<br><br>    app.UseEndpoints(endpoints =&gt;<br>    {<br>        endpoints.MapControllers();<br>    });<br>}</pre><h4>2.4 Implement Token Issuance</h4><p>Create a controller to issue tokens:</p><pre>[ApiController]<br>[Route(&quot;api/[controller]&quot;)]<br>public class TokenController : ControllerBase<br>{<br>    [HttpPost]<br>    public IActionResult GetToken([FromBody] UserCredentials credentials)<br>    {<br>        // Validate user credentials (e.g., against a database)<br><br>        var tokenHandler = new JwtSecurityTokenHandler();<br>        var key = Encoding.ASCII.GetBytes(&quot;{your-secret-key}&quot;);<br>        var tokenDescriptor = new SecurityTokenDescriptor<br>        {<br>            Subject = new ClaimsIdentity(new Claim[]<br>            {<br>                new Claim(ClaimTypes.Name, credentials.Username)<br>            }),<br>            Expires = DateTime.UtcNow.AddHours(1),<br>            SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)<br>        };<br>        var token = tokenHandler.CreateToken(tokenDescriptor);<br>        var tokenString = tokenHandler.WriteToken(token);<br><br>        return Ok(new { Token = tokenString });<br>    }<br>}<br><br>public class UserCredentials<br>{<br>    public string Username { get; set; }<br>    public string Password { get; set; }<br>}</pre><h3>Step 3: Create the Web API Application</h3><h4>3.1 Create a New .NET Core Project</h4><ol><li>Create a new <strong>ASP.NET Core Web API</strong> project named WebAPIApp.</li></ol><h4>3.2 Install Required NuGet Packages</h4><p>Install the following NuGet packages:</p><pre>dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer</pre><h4>3.3 Configure JWT Authentication</h4><p>In the Startup.cs file, configure JWT authentication:</p><pre>public void ConfigureServices(IServiceCollection services)<br>{<br>    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)<br>        .AddJwtBearer(options =&gt;<br>        {<br>            options.Authority = &quot;https://login.microsoftonline.com/{tenant-id}/v2.0&quot;;<br>            options.Audience = &quot;{client-id-of-WebAPIApp}&quot;;<br>        });<br><br>    services.AddControllers();<br>}<br><br>public void Configure(IApplicationBuilder app, IWebHostEnvironment env)<br>{<br>    if (env.IsDevelopment())<br>    {<br>        app.UseDeveloperExceptionPage();<br>    }<br><br>    app.UseRouting();<br><br>    app.UseAuthentication();<br>    app.UseAuthorization();<br><br>    app.UseEndpoints(endpoints =&gt;<br>    {<br>        endpoints.MapControllers();<br>    });<br>}</pre><h4>3.4 Protect API Endpoints</h4><p>Use the [Authorize] attribute to protect your API endpoints:</p><pre>[ApiController]<br>[Route(&quot;api/[controller]&quot;)]<br>public class ValuesController : ControllerBase<br>{<br>    [HttpGet]<br>    [Authorize]<br>    public IActionResult Get()<br>    {<br>        return Ok(new[] { &quot;value1&quot;, &quot;value2&quot; });<br>    }<br>}</pre><h3>Step 4: Integrate STS at the Gateway Level</h3><h4>4.1 Create an API Gateway</h4><p>You can use any API Gateway solution (e.g., Ocelot, Azure API Management) to route requests to your Web API.</p><h4>4.2 Configure the Gateway to Validate Tokens</h4><p>In the gateway configuration, ensure that incoming requests are validated against the STS application:</p><pre>{<br>  &quot;Routes&quot;: [<br>    {<br>      &quot;DownstreamPathTemplate&quot;: &quot;/api/{everything}&quot;,<br>      &quot;DownstreamScheme&quot;: &quot;https&quot;,<br>      &quot;DownstreamHostAndPorts&quot;: [<br>        {<br>          &quot;Host&quot;: &quot;localhost&quot;,<br>          &quot;Port&quot;: 5001<br>        }<br>      ],<br>      &quot;UpstreamPathTemplate&quot;: &quot;/api/{everything}&quot;,<br>      &quot;UpstreamHttpMethod&quot;: [ &quot;Get&quot;, &quot;Post&quot;, &quot;Put&quot;, &quot;Delete&quot; ],<br>      &quot;AuthenticationOptions&quot;: {<br>        &quot;AuthenticationProviderKey&quot;: &quot;Bearer&quot;,<br>        &quot;AllowedScopes&quot;: []<br>      }<br>    }<br>  ]<br>}</pre><h4>4.3 Forward the Token to the Web API</h4><p>Ensure that the gateway forwards the validated token to the Web API in the Authorization header.</p><h3>Step 5: Add Advanced Features and Security Enhancements</h3><h4><strong>5.1 Role-Based Access Control (RBAC)</strong></h4><p>Add roles to tokens and enforce role-based authorization in your Web API.</p><h4>5.2 Token Lifetime Management</h4><p>Configure token expiration and implement refresh tokens.</p><h4>5.3 Logging and Monitoring</h4><p>Log authentication events and monitor your system using Azure Monitor.</p><h4>5.4 Rate Limiting and Throttling</h4><p>Implement rate limiting and throttling to prevent abuse.</p><h4>5.5 Secure Communication (HTTPS)</h4><p>Enforce HTTPS and enable HSTS.</p><h4>5.6 Multi-Factor Authentication (MFA)</h4><p>Enable MFA in Azure AD B2C and handle MFA claims in the STS.</p><h4>5.7 Auditing and Compliance</h4><p>Log all access attempts and ensure compliance with GDPR and CCPA.</p><h3>Conclusion</h3><p>By following this guide, you’ve built a secure and scalable authentication system for your Web API using <strong>Azure AD B2C</strong>, <strong>an STS application</strong>, and <strong>an API Gateway</strong>. This architecture not only enhances security but also ensures modularity, scalability, and compliance with industry standards. Whether you’re building a small application or a large enterprise system, this approach provides a solid foundation for managing user authentication and authorization.</p><p><strong>Ready to implement this in your project?</strong> Start by setting up Azure AD B2C and follow the steps outlined above. If you have any questions or need further assistance, feel free to reach out in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cb2a1aca100" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concurrency and Idempotency in .NET Core: Essential Concepts for Banking Applications]]></title>
            <link>https://medium.com/@mohammadalyasfo/concurrency-and-idempotency-in-net-core-essential-concepts-for-banking-applications-faf28bc32014?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/faf28bc32014</guid>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[idempotency]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Tue, 21 Jan 2025 15:24:12 GMT</pubDate>
            <atom:updated>2025-01-21T15:30:41.865Z</atom:updated>
            <content:encoded><![CDATA[<h3>Concurrency and Idempotency in .NET Core: Essential Concepts for Banking Applications</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNxkO3ytDnaZNYNmcDh_xw.jpeg" /><figcaption>Concurrency and Idempotency in .NET Core: Essential Concepts for Banking Applications</figcaption></figure><p>Banking systems require precision and reliability. <strong>Concurrency </strong>and <strong>Idempotency </strong>play a crucial role in managing multiple simultaneous operations and ensuring consistent results, even when processes are repeated due to retries. Below, we explore these concepts with practical examples in .NET Core, focusing on how to implement them effectively in production environments.</p><h3>Concurrency: Managing Simultaneous Access</h3><p>Concurrency ensures that multiple operations on shared resources, like bank accounts, do not lead to data corruption or inconsistencies.</p><h4>1. Optimistic Concurrency</h4><p>Optimistic concurrency assumes conflicts are rare and allows multiple processes to work independently until changes are saved. A conflict is detected when another process modifies the data during the update.</p><p><strong>Implementation Example</strong>:</p><pre>public class Account<br>{<br>    public int Id { get; set; }<br>    public decimal Balance { get; set; }<br>    [Timestamp]<br>    public byte[] RowVersion { get; set; } // Used for concurrency checks<br>}</pre><p>In the update logic:</p><pre>/// &lt;summary&gt;<br>/// Updates the account balance while ensuring optimistic concurrency checks.<br>/// &lt;/summary&gt;<br>/// &lt;param name=&quot;accountId&quot;&gt;The ID of the account to update.&lt;/param&gt;<br>/// &lt;param name=&quot;amount&quot;&gt;The amount to add to the balance.&lt;/param&gt;<br>/// &lt;returns&gt;HTTP response indicating success or a concurrency conflict.&lt;/returns&gt;<br>public async Task&lt;IActionResult&gt; UpdateBalance(int accountId, decimal amount)<br>{<br>    // Retrieve the account<br>    var account = await _dbContext.Accounts.FindAsync(accountId);<br>    if (account == null)<br>        return NotFound(&quot;Account not found.&quot;);<br><br>    // Update balance<br>    account.Balance += amount;<br><br>    try<br>    {<br>        // Save changes and ensure concurrency checks are passed<br>        await _dbContext.SaveChangesAsync();<br>        return Ok(&quot;Balance updated.&quot;);<br>    }<br>    catch (DbUpdateConcurrencyException)<br>    {<br>        // Handle concurrency conflict<br>        return Conflict(&quot;Concurrency conflict detected.&quot;);<br>    }<br>}</pre><h4>2. Pessimistic Concurrency</h4><p>In scenarios where conflicts are likely, pessimistic concurrency locks resources, ensuring only one process modifies them at a time.</p><p><strong>Implementation Example</strong>:</p><pre>/// &lt;summary&gt;<br>/// Deducts a fixed amount from the account balance using pessimistic concurrency (locking).<br>/// &lt;/summary&gt;<br>/// &lt;param name=&quot;accountId&quot;&gt;The ID of the account to debit.&lt;/param&gt;<br>/// &lt;returns&gt;HTTP response indicating success or failure.&lt;/returns&gt;<br>public async Task&lt;IActionResult&gt; DeductBalanceWithLock(int accountId)<br>{<br>    using (var transaction = await _dbContext.Database.BeginTransactionAsync())<br>    {<br>        // Retrieve account with lock to prevent concurrent modifications<br>        var account = await _dbContext.Accounts<br>            .FromSqlRaw(&quot;SELECT * FROM Accounts WITH (UPDLOCK) WHERE Id = {0}&quot;, accountId)<br>            .FirstOrDefaultAsync();<br><br>        if (account == null)<br>            return NotFound(&quot;Account not found.&quot;);<br><br>        // Deduct amount<br>        account.Balance -= 100;<br>        _dbContext.Accounts.Update(account);<br><br>        // Save changes and commit transaction<br>        await _dbContext.SaveChangesAsync();<br>        await transaction.CommitAsync();<br><br>        return Ok(&quot;Funds debited.&quot;);<br>    }<br>}</pre><h3>Idempotency: Avoiding Repeated Actions</h3><p>Idempotency ensures that the same operation produces identical outcomes, regardless of how many times it is executed. This is vital for operations like payments or transfers that might be retried due to network failures.</p><h4>1. Idempotency Key Implementation</h4><p>Assigning a unique key to each request ensures it is not processed multiple times.</p><p><strong>Implementation Example</strong>:</p><pre>public class ProcessedRequest<br>{<br>    public string IdempotencyKey { get; set; }<br>    public DateTime ProcessedAt { get; set; }<br>}<br><br>/// &lt;summary&gt;<br>/// Processes a payment request while ensuring idempotency.<br>/// &lt;/summary&gt;<br>/// &lt;param name=&quot;request&quot;&gt;The payment request containing account ID, amount, and an idempotency key.&lt;/param&gt;<br>/// &lt;returns&gt;HTTP response indicating the result of the operation.&lt;/returns&gt;<br>public async Task&lt;IActionResult&gt; ProcessPayment(PaymentRequest request)<br>{<br>    // Check if the request has already been processed using the idempotency key<br>    if (await _dbContext.ProcessedRequests.AnyAsync(r =&gt; r.IdempotencyKey == request.IdempotencyKey))<br>        return Ok(&quot;Request already processed.&quot;);<br><br>    // Retrieve the account<br>    var account = await _dbContext.Accounts.FindAsync(request.AccountId);<br>    if (account == null)<br>        return NotFound(&quot;Account not found.&quot;);<br><br>    // Validate account balance<br>    if (account.Balance &lt; request.Amount)<br>        return BadRequest(&quot;Insufficient funds.&quot;);<br><br>    // Deduct the payment amount<br>    account.Balance -= request.Amount;<br>    _dbContext.Accounts.Update(account);<br><br>    // Log the processed request to maintain idempotency<br>    _dbContext.ProcessedRequests.Add(new ProcessedRequest<br>    {<br>        IdempotencyKey = request.IdempotencyKey,<br>        ProcessedAt = DateTime.UtcNow<br>    });<br><br>    // Save changes<br>    await _dbContext.SaveChangesAsync();<br>    return Ok(&quot;Payment processed successfully.&quot;);<br>}</pre><h4>2. Atomic Operations for Idempotency</h4><p>Using transactions ensures operations are fully completed or entirely rolled back in case of errors, maintaining consistency.</p><p><strong>Implementation Example</strong>:</p><pre>/// &lt;summary&gt;<br>/// Transfers funds between two accounts while ensuring concurrency and idempotency.<br>/// &lt;/summary&gt;<br>/// &lt;param name=&quot;request&quot;&gt;The transfer request containing source and destination account IDs, amount, and an idempotency key.&lt;/param&gt;<br>/// &lt;returns&gt;HTTP response indicating the result of the operation.&lt;/returns&gt;<br>public async Task&lt;IActionResult&gt; TransferFunds(FundTransferRequest request)<br>{<br>    // Check if the request has already been processed using the idempotency key<br>    if (await _dbContext.ProcessedRequests.AnyAsync(r =&gt; r.IdempotencyKey == request.IdempotencyKey))<br>        return Ok(&quot;Request already processed.&quot;);<br><br>    using (var transaction = await _dbContext.Database.BeginTransactionAsync())<br>    {<br>        try<br>        {<br>            // Retrieve source and destination accounts<br>            var fromAccount = await _dbContext.Accounts.FindAsync(request.FromAccountId);<br>            var toAccount = await _dbContext.Accounts.FindAsync(request.ToAccountId);<br><br>            // Validate accounts and balance<br>            if (fromAccount == null || toAccount == null)<br>                return NotFound(&quot;Account(s) not found.&quot;);<br>            if (fromAccount.Balance &lt; request.Amount)<br>                return BadRequest(&quot;Insufficient funds in the source account.&quot;);<br><br>            // Perform the transfer<br>            fromAccount.Balance -= request.Amount;<br>            toAccount.Balance += request.Amount;<br><br>            // Update accounts<br>            _dbContext.Accounts.Update(fromAccount);<br>            _dbContext.Accounts.Update(toAccount);<br><br>            // Log the processed request for idempotency<br>            _dbContext.ProcessedRequests.Add(new ProcessedRequest<br>            {<br>                IdempotencyKey = request.IdempotencyKey,<br>                ProcessedAt = DateTime.UtcNow<br>            });<br><br>            // Save changes and commit transaction<br>            await _dbContext.SaveChangesAsync();<br>            await transaction.CommitAsync();<br><br>            return Ok(&quot;Funds transferred successfully.&quot;);<br>        }<br>        catch<br>        {<br>            // Rollback transaction in case of failure<br>            await transaction.RollbackAsync();<br>            throw;<br>        }<br>    }<br>}</pre><h3>Combining Concurrency and Idempotency in Banking</h3><p>Consider a money transfer operation:</p><ol><li><strong>Concurrency Handling</strong>: Use locking or optimistic concurrency to ensure account balances are updated safely when multiple requests occur.</li><li><strong>Idempotency</strong>: Ensure retries do not cause double deductions or inconsistent states by logging processed requests with unique identifiers.</li></ol><h3>Additional Insights: Implementing Retry Mechanisms</h3><p>For robust error handling:</p><ul><li><strong>Transient Failures</strong>: Retry with exponential backoff (e.g., 5, 25, and 125 seconds).</li><li><strong>Non-Transient Failures</strong>: Move problematic messages to the dead-letter queue immediately.</li></ul><p>Example of retry mechanism:</p><pre>/// &lt;summary&gt;<br>/// Executes an operation with exponential backoff retry in case of transient exceptions.<br>/// &lt;/summary&gt;<br>/// &lt;param name=&quot;operation&quot;&gt;The asynchronous operation to be executed.&lt;/param&gt;<br>/// &lt;returns&gt;A Task representing the asynchronous operation.&lt;/returns&gt;<br>/// &lt;exception cref=&quot;PermanentFailureException&quot;&gt;Thrown if the operation fails after all retry attempts.&lt;/exception&gt;<br>private async Task RetryWithBackoff(Func&lt;Task&gt; operation)<br>{<br>    // Define retry delays (exponential backoff intervals).<br>    var retryDelays = new[] { 5, 25, 125 };<br><br>    foreach (var delayInSeconds in retryDelays)<br>    {<br>        try<br>        {<br>            // Attempt the operation<br>            await operation();<br>            return; // Exit if operation succeeds<br>        }<br>        catch (TransientException)<br>        {<br>            // Wait for the specified delay before retrying<br>            await Task.Delay(TimeSpan.FromSeconds(delayInSeconds));<br>        }<br>    }<br><br>    // Throw an exception if all retries fail<br>    throw new PermanentFailureException(&quot;Operation failed after all retry attempts.&quot;);<br>}</pre><h3>Conclusion</h3><p>Concurrency and idempotency are essential for building robust financial systems. By leveraging .NET Core’s tools and implementing principles like optimistic/pessimistic concurrency, idempotency keys, and transactional operations, developers can ensure reliable, accurate, and user-friendly banking applications. With thoughtful design, these practices enhance trust and prevent common pitfalls in high-stakes operations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=faf28bc32014" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Stripe Integration with ASP.NET Core: A Comprehensive Guide]]></title>
            <link>https://medium.com/@mohammadalyasfo/building-a-stripe-integration-with-asp-net-core-a-comprehensive-guide-64c5964799f0?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c5964799f0</guid>
            <category><![CDATA[payment-gateway]]></category>
            <category><![CDATA[stripe-payment]]></category>
            <category><![CDATA[stripe-integration]]></category>
            <category><![CDATA[stripe]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 19:43:09 GMT</pubDate>
            <atom:updated>2025-01-19T19:43:09.350Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CApNqeIk2wEU8ih5lVrfXQ.jpeg" /><figcaption>Building a Stripe Integration with ASP.NET Core: A Comprehensive Guide</figcaption></figure><p>Integrating Stripe into your ASP.NET Core application provides a secure and scalable way to manage payments, subscriptions, and financial workflows. This article offers a detailed, step-by-step guide to implementing Stripe using a sample service, StripePaymentProviderService.</p><h3>Why Choose Stripe?</h3><p>Stripe is a preferred choice for developers due to its:</p><ul><li><strong>Robust API</strong>: Simplifies payment processing, subscription management, and financial operations.</li><li><strong>Developer-Friendly Tools</strong>: Offers client-side and server-side SDKs for streamlined integration.</li><li><strong>Built-In Features</strong>: Includes fraud detection, refund handling, and reporting.</li></ul><h3>Breaking Down the Code</h3><p>The sample service, StripePaymentProviderService, demonstrates how to manage core payment workflows such as account linking, payment processing, and account deauthorization.</p><h3>Key Components</h3><ol><li><strong>Configuration Management</strong></li></ol><ul><li><strong>StripeConfig</strong>: Stores essential Stripe credentials such as SecretKey, PublishableKey, and OAuth-related settings.</li><li><strong>StripeExceptionHandler</strong>: Maps Stripe errors to user-friendly messages, enhancing error handling and troubleshooting.</li></ul><p><strong>2. Core Methods</strong></p><ul><li><strong>GetPublishableKey</strong>: Retrieves the publishable key required for client-side tokenization.</li><li><strong>GetLinkAccountUrl</strong>: Generates a link for users to authorize their Stripe account with your platform.</li><li><strong>AuthorizeAccount</strong>: Uses OAuth to link a user’s Stripe account, enabling payments on their behalf.</li><li><strong>Pay</strong>: Processes payments securely with Stripe’s Charge API.</li><li><strong>DeauthorizeAccount</strong>: Revokes a Stripe account’s access to your application.</li></ul><h3>Integrating Stripe Using the .NET SDK</h3><p>Stripe’s official .NET SDK, Stripe.net, simplifies API interactions. Install the SDK using NuGet:</p><pre>dotnet add package Stripe.net</pre><h3>Step 1: Secure Configuration</h3><p>To authenticate API calls, configure your application with Stripe credentials. Create a StripeConfiguration class:</p><pre>public class StripeConfiguration<br>{<br>    public string ClientId { get; set; }<br>    public string PublishableKey { get; set; }<br>    public string SecretKey { get; set; }<br>    public string OAuthBaseLink { get; set; }<br>}</pre><p>Load these settings securely, such as from appsettings.json or environment variables:</p><pre>{<br>    &quot;Stripe&quot;: {<br>        &quot;ClientId&quot;: &quot;your-client-id&quot;,<br>        &quot;PublishableKey&quot;: &quot;your-publishable-key&quot;,<br>        &quot;SecretKey&quot;: &quot;your-secret-key&quot;,<br>        &quot;OAuthBaseLink&quot;: &quot;https://dashboard.stripe.com/oauth/authorize&quot;<br>    }<br>}</pre><p>Register the configuration in Program.cs:</p><pre>services.Configure&lt;StripeConfiguration&gt;(Configuration.GetSection(&quot;Stripe&quot;));<br>services.AddScoped&lt;StripePaymentProviderService&gt;();</pre><h3>Step 2: Implement Key Workflows</h3><h4>Retrieving the Publishable Key</h4><p>This key is used for client-side integration with Stripe’s front-end SDK:</p><pre>var publishableKey = await _stripePaymentProviderService.GetPublishableKey();</pre><h4>Generating an Account Link</h4><p>Redirect users to Stripe’s OAuth authorization page:</p><pre>var linkUrl = await _stripePaymentProviderService.GetLinkAccountUrl(companyId, redirectUri);<br>return Redirect(linkUrl);</pre><h4>Authorizing Accounts</h4><p>The AuthorizeAccount method demonstrates how to handle the OAuth flow:</p><pre>var options = new OAuthTokenCreateOptions<br>{<br>    GrantType = &quot;authorization_code&quot;,<br>    Code = paymentAccount.Code,<br>};<br>var service = new OAuthTokenService();<br>var token = service.Create(options);</pre><p>This generates a token, allowing your application to manage payments on behalf of the linked account.</p><h4>Processing Payments</h4><p>The Pay method securely processes payments using the ChargeService:</p><pre>var payOptions = new ChargeCreateOptions<br>{<br>    Source = model.SourceCardToken,<br>    Description = model.Description,<br>    Currency = model.Currency,<br>    Amount = (long)model.Amount * 100, // Amount in cents.<br>    Capture = true,<br>    Metadata = new Dictionary&lt;string, string&gt;<br>    {<br>        { &quot;BookingId&quot;, model.BookingId.ToString() }<br>    }<br>};<br>var payService = new ChargeService();<br>var charge = payService.Create(payOptions);</pre><h4>Handling Errors Gracefully</h4><p>The StripeExceptionHandler maps API errors to actionable messages:</p><pre>try<br>{<br>    var result = await _stripePaymentProviderService.Pay(paymentRequest);<br>}<br>catch (StripeException ex)<br>{<br>    var errorMessage = StripeExceptionHandler.GetMessage(ex);<br>    // Log or display the error<br>}</pre><h3>Testing in Sandbox Mode</h3><p>Stripe offers a sandbox mode to simulate real-world scenarios without impacting production data:</p><ol><li><strong>Test API Keys</strong>: Use keys from your Stripe dashboard for sandbox testing.</li><li><strong>Test Cards</strong>: Stripe provides predefined test card numbers to validate success and failure scenarios. For instance:</li></ol><ul><li>Successful payment: 4242 4242 4242 4242</li><li>Insufficient funds: 4000 0000 0000 9995</li></ul><h3>Real-World Use Cases</h3><ol><li><strong>Account Onboarding</strong> Allow users to link their Stripe accounts for accepting payments or receiving payouts.</li><li><strong>Payment Processing</strong> Handle payments for services, subscriptions, or e-commerce transactions securely.</li><li><strong>Subscription Management</strong> Use Stripe’s Subscription API to enable recurring billing for users.</li></ol><h3>Enhancing Your Integration</h3><ul><li><strong>Security</strong>: Store sensitive keys in a secure vault or environment variables.</li><li><strong>Logging</strong>: Implement robust logging to monitor API calls and debug issues effectively.</li><li><strong>Webhooks</strong>: Set up Stripe webhooks to handle asynchronous events like payment success, disputes, or refunds.</li></ul><h3>Code Repository</h3><p>For a complete implementation, visit the GitHub repository: <a href="https://github.com/Mohammad-Yasfo/StripeNetSample">GitHub Repo Link</a>.</p><p>By following this guide, you’ll build a secure and scalable Stripe integration in your ASP.NET Core application. With Stripe’s robust API and tools, you can provide a seamless payment experience for your users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c5964799f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Cost Savings: A Simple Guide to Cutting Expenses]]></title>
            <link>https://medium.com/@mohammadalyasfo/azure-cost-savings-a-simple-guide-to-cutting-expenses-5b0177b72326?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b0177b72326</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cost-management]]></category>
            <category><![CDATA[azure-cost-optimization]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[azure-cost-management]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 13:20:46 GMT</pubDate>
            <atom:updated>2024-12-24T13:20:46.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eT6wYQufCRNQozn-RGhXQA.jpeg" /></figure><p><strong>How I Reduced Azure Costs by Over 78% for Non-Production Environments</strong></p><p>Cloud costs can quickly spiral out of control if not monitored and optimized regularly. Recently, I took on the challenge of reducing our Azure spending while maintaining performance and efficiency. The result? A significant cost reduction — over 78% for our Staging and Development environments. Here’s how I achieved it.</p><p>This subscription involved optimizing an infrastructure comprising <strong>15 Azure App Services</strong>, each integrated with <strong>Application Insights</strong>, <strong>two Azure SQL Servers</strong> hosting a total of <strong>16 databases</strong>, <strong>two Redis </strong>services, and <strong>two SignalR </strong>services, along with other associated resources. The high cost of maintaining these services in non-production environments prompted the optimization effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THfWg8bQQU8YUMQPugpMAw.png" /><figcaption>Cost Management Overview</figcaption></figure><h3>From almost £1,606.91 to £343.83: The Cost of Test Environments</h3><p>Our <strong>Development and Staging environments</strong>, meant for testing, were costing a staggering almost <strong>£1,606.91 per month</strong> due to unnecessary configurations and underutilized resources. After streamlining and optimizing, the monthly cost dropped to just <strong>£343.94</strong>, a reduction of over 78%. Here’s what made the difference:</p><h3>Key Changes That Made a Difference</h3><h4>1. Merged App Service Plans</h4><p>Each service in our infrastructure had its own <strong>App Service Plan</strong>, leading to resource underutilization. I consolidated these into fewer, larger <strong>App Service Plans</strong>, ensuring optimal usage of CPU and memory. Services using less than 20% CPU were especially good candidates for this approach.</p><h4>2. Switched Operating System: Windows to Linux</h4><p>Since we use <strong>.NET Core</strong>, switching our <strong>App Services</strong> from Windows to Linux was straightforward. Linux App Service Plans are significantly cheaper, and .NET Core supports cross-platform deployment.<br><strong>Tip</strong>: If your application relies on Windows-specific libraries, ensure compatibility before making this change.</p><h4>3. Disabled Azure Microsoft Defender for Test Environments</h4><p>While security is critical, enabling <strong>Azure Microsoft Defender</strong> for non-production environments like <strong>Dev</strong> and <strong>Staging</strong> isn’t always necessary. By disabling this feature in these environments, we cut unnecessary expenses without compromising production security.</p><h4>4. Reduced Frontend Logging Volume</h4><p>Our <strong>frontend applications</strong> were logging excessively, costing us close to <strong>£200 per month</strong>. After identifying the source of these logs, we adjusted the logging levels to capture only what was necessary, significantly reducing this cost.</p><h4>5. Optimized Geo-Redundancy</h4><p>For non-critical applications, I adjusted <strong>geo-redundancy</strong> settings to locally redundant storage. This step saved costs while maintaining adequate reliability for these applications.</p><h3>Results: Over 78% Cost Reduction in Dev and Staging</h3><p>The combined effect of these changes led to a <strong>cost reduction of over 78% in our Development and Staging environments</strong>, while maintaining performance and functionality.</p><p>Before optimization: <strong>£1,606.91 per month</strong><br>After optimization: <strong>£343.94 per month</strong></p><p>This dramatic reduction was achieved by applying targeted optimizations to test environments without impacting production services.</p><h3>How to Monitor and Optimize Your Azure Resources</h3><p>To ensure you’re making informed decisions, regular monitoring of resource usage is crucial. Here’s how you can check and optimize your Azure services:</p><ol><li><strong>Use Azure Monitor and Application Insights</strong>: These tools provide detailed insights into resource usage, performance, and bottlenecks.</li><li><strong>Analyze App Service Plans</strong>: Look at metrics like <strong>CPU usage</strong>, <strong>memory consumption</strong>, and <strong>request count</strong>. Under-utilized plans are prime candidates for merging.</li><li><strong>Review Logging</strong>: Identify sources of excessive logs and adjust logging levels to avoid unnecessary costs.</li><li><strong>Evaluate Redundancy Needs</strong>: Consider locally redundant options for non-critical apps instead of geo-redundant solutions.</li></ol><h3>Tips for Long-Term Savings on Azure</h3><p>If you’re committed to Azure for the long term, consider the following for additional savings:</p><ul><li><strong>Reservations</strong>: Reserving instances for <strong>1–3 years</strong> can provide significant discounts compared to pay-as-you-go pricing.</li><li><strong>Consistent Monitoring</strong>: Regularly use Azure’s <strong>Cost Management</strong> tools to track expenses and identify areas for improvement.</li><li><strong>Environment-Specific Settings</strong>: Apply cost-saving measures to non-production environments, as they often don’t require the same level of resources as production.</li></ul><h3>Final Thoughts</h3><p>Cloud cost optimization is an ongoing process. By identifying waste, leveraging platform features, and aligning resources with actual needs, I achieved a significant reduction in Azure costs. These steps not only saved money but also set up a more efficient and scalable infrastructure.</p><p>I hope this experience inspires you to explore ways to optimize your cloud spending while maintaining high performance. Let me know in the comments if you’ve tried any of these strategies or have others to share!</p><p><strong>Note:</strong> The recommendations in this article are specifically aimed at non-production environments (e.g., Development and Staging). These cost-saving measures, such as disabling certain security features or reducing redundancy, are not suitable for production environments, where reliability, performance, and security should remain the top priority.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b0177b72326" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Power of Azure CDN: A Game-Changer for Media Delivery]]></title>
            <link>https://medium.com/@mohammadalyasfo/exploring-the-power-of-azure-cdn-a-game-changer-for-media-delivery-43f67b2d055f?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/43f67b2d055f</guid>
            <category><![CDATA[content-delivery-network]]></category>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[caching-solutions]]></category>
            <category><![CDATA[azure-cdn]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Sun, 22 Dec 2024 16:12:37 GMT</pubDate>
            <atom:updated>2024-12-22T16:12:37.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3b_fd3icibWQun_tSJs2oA.jpeg" /><figcaption>Microsoft Azure CDN</figcaption></figure><p>When it comes to delivering digital experiences to users, speed and reliability are essential. Whether you’re running a busy e-commerce platform or managing a platform with lots of images and videos, making sure everything runs smoothly is critical. This is where <strong>Azure Content Delivery Network (CDN)</strong> helps. As a cloud-based content delivery tool, Azure CDN improves user experiences by storing and sharing content from servers around the world. In this article, we’ll explore some of the key features of Azure CDN and how it solved a problem I recently faced.</p><h3>Key Features of Azure CDN</h3><p>Azure CDN offers many features that make it a great tool for modern web applications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*o3-bl8DQXb_rgZFaeS0Ubg.png" /><figcaption>Using Azure CDN to optimize the delivery of your media content.</figcaption></figure><h3>1. Global Reach with Low Latency</h3><p>Azure CDN uses Microsoft’s global network of servers to bring content closer to your users. By reducing the distance between the server and the user, it ensures faster load times.</p><h3>2. Faster Delivery for Dynamic Content</h3><p>For dynamic web content that cannot be stored like static files, Azure CDN uses smart routes and better protocols to make delivery faster.</p><h3>3. Content Compression</h3><p>Azure CDN supports automatic compression of files, reducing bandwidth consumption and improving load times. Formats like GZIP and Brotli are commonly used to achieve efficient compression.</p><h3>4. Advanced Caching Rules</h3><p>Azure CDN enables detailed caching control, letting you define how and when your content should be cached or refreshed. This is particularly helpful for managing time-sensitive media or frequently updated data.</p><h3>5. Secure Content Delivery</h3><p>With built-in features like HTTPS support, custom domains, and token-based authentication, Azure CDN ensures your content is securely delivered to your users.</p><h3>6. Real-Time Analytics</h3><p>Gain insights into traffic, performance, and user behaviors with real-time analytics. This helps in fine-tuning content strategies and optimizing delivery further.</p><h3>My Experience: Optimizing Media Delivery with Azure CDN</h3><p>Recently, I encountered a significant challenge while managing a venue and space gallery application within our booking system. Users frequently uploaded high-resolution images to showcase events in the gallery. The platform allowed clients to upload images up to 28 MB each. While this flexibility was highly appreciated for presenting their venues and spaces effectively, it often led to delays in uploading and serving these images to end-users.</p><p>To address this issue, I turned to <strong>Azure CDN</strong>. Here’s how it helped:</p><h4>1- Improved Media Delivery</h4><p>I configured Azure CDN to cache the uploaded images at edge servers located near the users. This significantly reduced the time it took to load these large images on the gallery, enhancing the user experience.</p><h4>2- Efficient Compression</h4><p>Using Azure CDN’s built-in compression capabilities, the images were automatically compressed during transfer. This not only reduced bandwidth costs but also improved delivery speeds.</p><h4>3- Reduced Upload Delays</h4><p>To address the delay during uploads, I explored optimizing the backend storage and integrating Azure’s blob storage with CDN. By combining these services, the large images were handled more efficiently during the upload process, reducing timeouts and improving reliability.</p><h3>Conclusion</h3><p>Azure CDN has proven to be a robust solution for optimizing content delivery, especially for media-rich platforms. Its global reach, compression capabilities, and advanced caching rules make it an essential tool for developers and businesses aiming to deliver top-notch user experiences.</p><p>By setting up Azure CDN for my application, I not only optimized the delivery of large media files but also ensured they were compressed during transfer to save bandwidth and boost performance. This setup addressed the delay issues we initially faced, making the platform more reliable for end-users.</p><p>If you’re looking to enhance your application’s performance and tackle similar challenges, Azure CDN might just be the solution you need. Have you used Azure CDN in your projects? Let me know your experiences in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43f67b2d055f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Technical Tips for Seamless Integration with External Software Systems]]></title>
            <link>https://medium.com/@mohammadalyasfo/implementing-technical-tips-for-seamless-integration-with-external-software-systems-5947b4cb5642?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/5947b4cb5642</guid>
            <category><![CDATA[webhooks]]></category>
            <category><![CDATA[system-integration]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[integration-solution]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Mon, 11 Nov 2024 10:33:36 GMT</pubDate>
            <atom:updated>2024-11-11T10:33:36.766Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A5pm1KV1Qk5b9cx8LFt4Mg.png" /><figcaption>System integration with external systems.</figcaption></figure><p>Building a robust, secure, and integration-ready software system is crucial in today’s interconnected digital ecosystem. Whether you’re developing a CRM, content management platform, or booking system, creating a scalable, secure, and integration-friendly architecture in .NET 8 is essential. This guide outlines practical steps to make your system ready for integration with external software, including implementing OAuth-based authentication, exposing RESTful APIs, setting up webhooks, and applying essential security practices.</p><h3>Integration-Ready Features for External Software Systems</h3><h3>1. Implementing OAuth 2.0 for Secure API Authentication</h3><p>Ensuring secure access to your API is foundational for enabling seamless integration. Here’s how to implement OAuth 2.0 compliant authentication in .NET 8 to facilitate secure connections with external systems:</p><ul><li><strong>Authentication Middleware</strong>: Leverage ASP.NET Core’s authentication middleware to enable OAuth 2.0, validating access tokens and authorizing requests.</li><li><strong>Endpoints for Token Generation</strong>: Set up API endpoints allowing users to generate tokens. For instance, a POST endpoint can issue tokens for authenticated users.</li><li><strong>Secure Token Storage</strong>: Associate generated tokens with users or clients and store them securely, such as in an encrypted database or a secure storage system.</li></ul><p>With OAuth in place, only authenticated clients can access your system, protecting your APIs from unauthorized access and preparing your software for secure external integrations.</p><h3>2. Exposing Entities as RESTful APIs</h3><p>Exposing key system entities as RESTful APIs enables other applications to programmatically interact with your system. Here’s how to set up these integrations effectively .NET 8:</p><ul><li><strong>Design RESTful Endpoints</strong>: For each key entity, create RESTful endpoints using ASP.NET Core, setting up controllers and defining routes.</li><li><strong>Implement Filtering, Pagination, and Search</strong>: Use query parameters for flexible data retrieval. Implement pagination to handle large datasets, and add search functionality using search endpoints or search parameters.</li></ul><p>These steps make your system ready to communicate with external applications by providing flexible data access and seamless integration opportunities.</p><h3>3. Implementing Webhooks for Real-Time Notifications</h3><p>Webhooks allow external systems to receive real-time updates about events in your software, which is critical for integrated workflows. Here’s a step-by-step approach to setting up webhooks:</p><ul><li><strong>Define Trigger Events</strong>: Determine which events should trigger webhooks, such as data creation, updates, or deletion.</li><li><strong>Specify Payload Data</strong>: Decide what data to include in the webhook payload, such as event type, timestamp, and relevant entity details.</li><li><strong>Event Publishing Mechanism</strong>: Implement an event publishing mechanism that captures and dispatches events to webhook subscribers.</li><li><strong>Webhook Configuration Options</strong>: Choose between customer-configurable webhooks (via a UI or API) or an internal configuration (storing URLs and subscriptions).</li><li><strong>Webhook Subscription Endpoint</strong>: Create an endpoint where external systems can register for specific events, specifying webhook URLs and desired event types.</li><li><strong>Error Handling and Retry Logic</strong>: Ensure robustness by implementing error handling and retry policies for failed webhook invocations, with exponential backoff to prevent overwhelming external systems.</li></ul><p>By integrating webhooks, your software can dynamically interact with external applications, keeping them up-to-date in real-time and ready for efficient data exchange.</p><h3>Security Best Practices for APIs</h3><p>To safeguard your system and make it integration-ready, follow these essential security practices:</p><ol><li><strong>Authentication</strong>: Implement OAuth, API keys, or JWT tokens to verify the identity of requesting systems, ensuring only authorized access.</li><li><strong>Encryption</strong>: Secure all data transmissions using HTTPS (TLS/SSL) to protect data confidentiality during communication.</li><li><strong>Access Control</strong>: Implement fine-grained access control, allowing each external system access only to the necessary data and functions.</li><li><strong>Input Validation</strong>: Validate input to prevent attacks like SQL injection and cross-site scripting (XSS).</li><li><strong>Rate Limiting</strong>: Defend against Distributed Denial of Service (DDoS) attacks and manage resources efficiently by limiting requests from each source.</li><li><strong>Monitoring and Logging</strong>: Track API usage to detect anomalies and maintain logs for troubleshooting and security investigations.</li><li><strong>Error Handling</strong>: Provide minimal error details to avoid revealing system vulnerabilities to potential attackers.</li><li><strong>Security Headers</strong>: Use security headers to protect against XSS, clickjacking, and code injection.</li><li><strong>Regular Updates</strong>: Stay current with API security updates to protect against newly discovered vulnerabilities.</li></ol><p>Following these best practices helps ensure your system remains secure, resilient to cyber threats, and prepared for secure, efficient integrations.</p><h3>Implementation Checklist</h3><p>Here’s a practical checklist of tasks to guide you through making your .NET 8 system ready for seamless integration with external software systems:</p><ul><li><strong>OAuth 2.0 Authentication</strong>: Set up secure API authentication and token generation.</li><li><strong>RESTful API Exposure</strong>: Design APIs with filtering, pagination, and search capabilities.</li><li><strong>Webhook Integration</strong>: Define events, configure webhooks, and implement error handling and retry logic.</li><li><strong>API Security Measures</strong>: Apply best practices like input validation, rate limiting, and security headers.</li></ul><h3>Conclusion</h3><p>By implementing these integration-ready technical tips and security best practices in your .NET 8 software system, you create a powerful platform ready for external integration. Securing your API, exposing entities through RESTful APIs, integrating webhooks, and applying robust security measures prepares your system for seamless interoperability with other applications. These steps position your system to thrive in today’s digital ecosystem, expanding its capabilities for future integrations and scalable growth.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5947b4cb5642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Oracle Hospitality Integration Platform (OHIP)]]></title>
            <link>https://medium.com/@mohammadalyasfo/getting-started-with-oracle-hospitality-integration-platform-ohip-cec7a2dea688?source=rss-69fbeb539494------2</link>
            <guid isPermaLink="false">https://medium.com/p/cec7a2dea688</guid>
            <category><![CDATA[oracle-hospitality]]></category>
            <category><![CDATA[integration-platform]]></category>
            <category><![CDATA[opera-pms]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[integration-solution]]></category>
            <dc:creator><![CDATA[Mohammad Jafar AlYasfo]]></dc:creator>
            <pubDate>Tue, 05 Nov 2024 19:53:43 GMT</pubDate>
            <atom:updated>2024-11-05T20:03:49.970Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRH6UEZsTRWIviZKbuLK3A.png" /><figcaption>Oracle Hospitality Integration Platform (OHIP)</figcaption></figure><h3>Introduction</h3><p>Oracle Hospitality Integration Platform (OHIP) serves as a pivotal resource for developers looking to integrate modern APIs into hospitality systems. With over 3,000 business capabilities and a user-centric design, OHIP offers a seamless way to enhance guest experiences through innovative and flexible solutions. This guide will walk you through the initial steps of getting started with OHIP, from accessing the developer portal to making your first API call.</p><h3>Step-by-Step Guide to Onboarding with OHIP</h3><h3>Step 1: Access the Developer Portal</h3><p>To kick off your journey with OHIP, start by navigating to the <strong>Oracle Hospitality Integration Developer Portal</strong>. This platform is the primary hub for all resources you’ll need, including API documentation, user guides, and support forums. Take some time to explore the portal layout to familiarize yourself with its structure and make future navigation easier.</p><h3>Step 2: Create an Account</h3><p>If you don’t already have an account, you’ll need to register:</p><ul><li>Locate the <strong>“Sign Up”</strong> or <strong>“Register”</strong> button on the homepage.</li><li>Complete the registration form by providing your name, email, and company details.</li><li>Verify your account through the confirmation email sent to your provided address.</li><li>Ensure that you use a professional email that can be monitored for notifications related to your API usage.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*2wSfKUT_Q5xDvQjdptokmw.jpeg" /><figcaption>Login to <strong>Oracle Hospitality Integration Developer Portal</strong></figcaption></figure><h3>Step 3: Register Your Application</h3><p>Once logged in, head to the <strong>Applications</strong> tab to register your application:</p><ul><li>Click on <strong>“Register Application”</strong>.</li><li>Enter the required details such as:</li><li><strong>Application Name</strong>: Choose a descriptive name.</li><li><strong>Application Type</strong>: Specify the nature of your application (web, mobile, etc.).</li><li><strong>Contact Information</strong>: Provide a valid contact name and email.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*4PiJ4TJOdsXJdjyyf__2uA.jpeg" /><figcaption>Register Application Interface in Oracle Hospitality Portal</figcaption></figure><h3>Step 4: Subscribe to APIs</h3><p>After registering your application, proceed to subscribe to relevant APIs:</p><ul><li>Browse through the API subscription section and review the descriptions to understand the capabilities offered.</li><li>Common choices include <strong>Early Adopter APIs</strong> and <strong>Hospitality APIs</strong>.</li><li>Select the APIs that align with your project needs and complete the subscription.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7WP9-2JG3jZ7sd4ocyYdw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96p0L3q-H-eDB-JSnwXdrQ.jpeg" /><figcaption>API Overview in Oracle Hospitality</figcaption></figure><h3>Step 5: Obtain Your Application Key</h3><p>Your application key, generated upon successful registration, is vital for authenticating API calls:</p><ul><li>Navigate to the application details page to find your unique key.</li><li>Store this key securely, as it is essential for API access.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*4sM7YrAVNZe0-5bWXHQ4aQ.jpeg" /></figure><h3>Step 6: Set Up OAuth</h3><p>After registration, you will receive a <strong>Client ID</strong> and <strong>Client Secret</strong>:</p><ul><li>The <strong>Client ID</strong> identifies your application during requests.</li><li>The <strong>Client Secret</strong> acts as a password for added security.</li><li>Keep these credentials confidential to prevent unauthorized access.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qm6TbdAywlNYbR5sznT7xw.jpeg" /><figcaption>Sandbox Environment Details (Gateway URL, Client ID, Client Secret)</figcaption></figure><h3>Step 7: Review API Documentation</h3><p>Before making any API calls, take the time to review the available documentation:</p><ul><li>Explore the <strong>API documentation</strong> section to understand request and response structures, error handling, and endpoint details.</li><li>Utilize examples provided to better comprehend how to frame your API requests.</li></ul><h3>Step 8: Make Your First API Call</h3><p>Testing your first API call can be done using tools like <strong>Postman</strong>:</p><ul><li>Download and install Postman, a widely used API testing tool.</li><li>Set up a new request with the necessary headers and request body.</li><li>Send your request and review the response to confirm successful integration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UC9GeWbH_LrnS0e263qbow.jpeg" /><figcaption>Postman Setup for OAuth API Token Retrieval</figcaption></figure><h3>Step 9: Explore the API Catalog</h3><p>OHIP boasts a comprehensive API catalog that lists all available APIs and their functionalities:</p><ul><li>Delve into the catalog to discover APIs that could enhance your application’s capabilities.</li></ul><h3>Step 10: Utilize Additional Resources</h3><p>OHIP offers a variety of resources for ongoing support:</p><ul><li><strong>OHIP User Guide</strong>: Step-by-step instructions for onboarding and using the platform effectively. <a href="https://docs.oracle.com/en/industries/hospitality/integration-platform/ohipu/c_oracle_hospitality_property_apis.htm">Oracle Docs</a></li><li><strong>GitHub Repository</strong>: Access sample code, API specifications, and more. <a href="https://github.com/oracle/hospitality-api-docs">GitHub</a></li><li><strong>Sample Postman Collections</strong>: Pre-built collections to see examples of API requests and responses. <a href="https://www.postman.com/hospitalityapis/oracle-hospitality-apis/overview">Postman</a>.</li><li><strong>Webinars and Tutorials:</strong> Watch video tutorials and recorded webinars that explain OHIP features. Start with this <a href="https://www.youtube.com/watch?v=sjff9pXiUf4">YouTube video</a>.</li></ul><h3>Key Requirements for Calling OAuth APIs</h3><p>To securely make calls to the OAuth API, you’ll need:</p><ul><li><strong>Application Key</strong>: A unique identifier for your registered application.</li><li><strong>Client ID</strong>: Identifies your application during the OAuth process.</li><li><strong>Client Secret</strong>: Used in conjunction with the Client ID for authentication.</li><li><strong>Integration Username and Password</strong>: Credentials specific to your API access.</li></ul><h3>Summary</h3><p>OHIP revolutionizes the way hospitality technology is approached by offering a modern, API-first integration experience. With a self-service model that enables swift onboarding and comprehensive resources for developers, OHIP empowers users to streamline processes from booking to checkout, creating a more satisfying guest journey.</p><h3>Highlights of OHIP</h3><ul><li><strong>Unified Platform</strong>: Offers over 3,000 business capabilities.</li><li><strong>Self-Service Onboarding</strong>: Reduces time to first API call.</li><li><strong>Contactless Experience</strong>: Facilitates a full guest journey through APIs.</li><li><strong>Extensive Documentation</strong>: Enhances understanding and integration confidence.</li><li><strong>Marketplace Access</strong>: Connects with partner solutions for enhanced functionality.</li></ul><h3>Final Thoughts</h3><p>OHIP’s robust and developer-friendly platform supports innovative hospitality solutions. Whether you are a seasoned developer or just starting out, OHIP’s API-driven model offers the flexibility and power needed to create efficient, scalable applications. Dive into the resources available and harness the potential of OHIP to elevate guest experiences and operational efficiency.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cec7a2dea688" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>