Saturday, November 12, 2022

Sitecore Azure AD B2C User.Identity.IsAuthenticated is false Set AuthenticationManager

 

Solution to use ExternalLoginCallBack

Sitecore exposes /identity/externallogincallback URL which basically invokes the HandleLoginLink processor whose primary responsibility is to transfer the AspNet.ExternalCookie issued by OIDC in to final AspNet.Cookies authentication token. The sitecore virtual users then get created and session is initialized. Therefore we must include the above end point as our callback end point. Once this callback is triggered, it will redirect the user to returnUrl specified.

https://stackoverflow.com/questions/29907155/external-cookie-for-external-login-in-asp-net-owin

https://blog.baslijten.com/federated-authentication-in-sitecore-error-unsuccessful-login-with-external-provider

Technically this is what it does behind the scene- This is just a hack , don't use this. Refer above code snippet to redirect to Sitecore external call back to get away with External Cookie reference.

Wednesday, October 19, 2022

Azure AD B2C Overview

App Registrations

  • Register your application in Azure AD B2C. 
  • Create new application ID or client ID that identifies your application.
Select Identity Provider
  • Facebook
  • Twitter
  • Google
  • Amazon
  • MS
  • Github
  • Local account


Select Policy

  • User flow- User sign up /sign in, reset , Change password etc.
  • Under user flow- select token claims
What is claim is a variable or attributes of logged in person- return user details post login

Claim: 
  • Display name
  • Email
  • Country
  • Job Title
  • Postcode
  • City
  • USER OBJECT
  • Identity provider

Tuesday, October 11, 2022

Scale up Scale down vs Scale In Scale Out

 

Scale In /Out

Scale Up/Down

Downtime: No downtime when provisioning in cloud

Downtime to some extent as there will be migration of code and configuration. No downtime when scaling process happens however migration of code configuration kicks off post scaling results in downtime.

Scenario: When code is alright, however no of users during the peak increases and server is unable to serve request. Increase no of boxes or instance to distribute loads of users across . Load balancing of users or distribution of users to serve request.

Scenario : When bad code or design leads to more CPU and memory utilizations. Need to increase server capacity

No sticky session Out proc session

In Proc session or state server session will do.

 

 

Thursday, September 1, 2022

Kubernetes 101 Know how

Clusters| Nodes| Pods| Helm

Node := Master Node + No. of Worker Nodes

Analogy: Cluster is like a train and Nodes are just like a compartment 






Kubernetes clusters are comprised of one master node and a number of worker nodes. These nodes can either be physical computers or virtual machines, depending on the cluster. The master node controls the state of the cluster; for example, which applications are running and their corresponding container images. 



25 supports clusters with up to 5000 nodes. More specifically, Kubernetes is designed to accommodate configurations that meet all of the following criteria: No more than 110 pods per node. No more than 5000 nodes

What are pods and clusters in Kubernetes?
A Kubernetes cluster consists of a set of worker machines, called nodes, that run containerized applications. Every cluster has at least one worker node. The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster.

Helm is a Kubernetes deployment tool for automating creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters. Kubernetes is a powerful container-orchestration system for application deployment

Tuesday, August 23, 2022

Content Security Policy CSP In or Out

Content Security Policy Script-src is something that tech lead or developer might have come across . This is one of the most common low security vulnerability defect raised by external penetration tester. They might suggest to whitelist Js library or third party libraries to safe guard against XSS attack. 

CSP protect from XSS


Well if you are working on .Net the only option you have is to add custom response header in Web.config file and list all JS. But here is the catch if you working with third party analytics this become tricky. There is a constraint and challenge to do so. Per say, these analytics injects lot of js libraries at runtime. It can be facebook , google tag manager, live person, social media plugins or advert. This is where one needs to draw line and give business technical reason why this cannot be achieved. Next stuff is browser compatibility. Under the hood testing will become exhaustive and chances are these are prones to more defects that leads to unknowns while move to production. Next time you come across CSP , think twice do your thorough research before you commit something. 

Sitecore XM Cloud Troubleshooting Part 2 Remote name could not be resolved 'dist.nuget.org'

Remote name could not be resolved 'dist.nuget.org'


Solution

Next, set the Interface Metric to 1 for Wi-Fi

Set-NetIPInterface -InterfaceAlias 'Wi-Fi' -InterfaceMetric 1


https://sitecore.stackexchange.com/questions/26095/remote-name-could-not-be-resolved-dist-nuget-org

 

Monday, August 22, 2022

Sitecore XM Cloud Deep Dive Troubleshooting Part 1

 I started with Github repo and followed the step. I got error while running the step given below

Bring up all the application elememnts for Local Mode

Next, use the up.ps1 script to bring up all of the containers required for Local Mode.

.\up.ps1
ERROR
a Windows version 10.0.20348-based image is incompatible with a 10.0.19042 host
I refer version of docker 
https://hub.docker.com/_/microsoft-dotnet-sdk
Go to .env file and change this configuration 
FROM
NETCORE_BUILD_IMAGE=mcr.microsoft.com/dotnet/sdk:6.0-nanoserver-ltsc2022
NETCORE_RELEASE_IMAGE= mcr.microsoft.com/dotnet/aspnet:6.0-nanoserver-ltsc2022
TO
NETCORE_BUILD_IMAGE=mcr.microsoft.com/dotnet/sdk:6.0.400-nanoserver-1809
NETCORE_RELEASE_IMAGE= mcr.microsoft.com/dotnet/aspnet:6.0.400-nanoserver-1809

Wednesday, July 20, 2022

C# Expression bodied Method reduce lines of code

C#: String.IsNullOrEmpty vs String.IsNullOrWhiteSpace

C#: String.IsNullOrEmpty vs String.IsNullOrWhiteSpace