#Sitecore Symposium 2024 Preview: Looking Forward to Learning and Networking

I always feel very blessed when I get to the Sitecore Symposium. I especially enjoy it when it takes place in a city I have never been to (Nashville). Besides seeing my co-workers from RBA I get to see a lot of people from the Sitecore community. Plus there is the MVP Summit, events, cool swag, the walks/runs I am going to organize etc… Most of all there are the presentations. I love attending them and sharing what I got to see. Hopefully I will get to implement some new ideas too.

  1. MVP Summit – Well this is a mix of presentations. What I hope to get out of it is learn what is coming out in the future. The Q&A sessions is my favorite part as I get to ask questions to various Sitecore representatives.
  2. Welcome Reception -This always gets me excited. It is a great way to kick off the Symposium and gives attendees a peak into the future of Sitecore.
  3. Rocking your website searches with AI magic and GenAI for translation. Just like everyone else I am excited about AI. I have been using AI in Content Hub lately, in programming, social media and soon hopefully in my next iPhone.
  4. A fireside chat with Katie Ledecky – I always love the insight of someone who is driven to succeed. Can’t wait to hear about her accomplishments.
  5. Disrupting the experience with generative AI – I am already using copilot. Finding out about generative AI will be great. It will add more tools to my development environment.
  6. Is AI bias the new elephant in the room? – I know based on the presenters this will be a great presentation. I know I will come out with a different perspective after this one.
  7. Sitecore Content Hub R&D roadmap and Continuous improvement with Sitecore Content Hub: From DAM to CMP and beyond – I love the Content Hub. Anything I can do to learn more about it is an opportunity I will take.
  8. Next-gen frontend development with XM Cloud – I am mainly a back-end developer, but I always want to learn more of the front-end. This presentation sounds perfect to take the next step.
  9. Driving engagement: From 0-60 in just 3 months to implement Sitecore Search and Personalize – This one sounds interesting as most clients need something yesterday to stay ahead of the curve.
  10. How to make generative AI think like your design team – This one involves combining Content Hub and AI. Sounds good to me.
  11. Drive hyper-personalized engagement in the healthcare and life sciences industries – I feel this is an important topic. Shared health data is important these days and seems to be the trend.
  12. Sitecore CDP: Unlock your data with unified tracking – Recently I have been engaging with Sitecore on this. I can’t wait to learn more.
  13. Building resilient integrations with XM Cloud – I know this presenter well. I have no doubt I will come out of this one with lots of new information.
  14. Revive, renew, reimagine: Sitecore XP renaissance – I really love XP. It may not always be the new shiny jewel, but it is extremely powerful still. Can’t wait to hear what is next as many clients still use it and are happy to continue using it.
  15. Headless SXA vs. Component Builder: The rock-off of the year – Always enjoy a good fight between to great ways to do things.
  16. A fireside chat with Brendan Hunt – Last, but not least. I am a huge Ted Lasso fan. I loved Coach Beard and also like the actor that portrays him even more being a fellow Chicagoan. I can’t wait to watch.

#Sitecore Content Hub Admin/Developer Exam Tips from a Nervous Test Taker

Within the last year I passed the Content Hub Admin and Developer exams. Being not so good at taking tests made things even more difficult. Even still for me I am sure there are others like me though so I wanted to give advice on how to give these exams your best shots. It is ok to fail, but not trying is even worst.

Get a Content Hub Sandbox and Start with one of the Available Demos.

Sitecore’s Demo Team has put together some impressive demos. I went through what they did and tried to understand everything. I went through the taxonomy, schemas, scripts etc… Not only did I learn new things it gave me ideas for future projects. If you learn by doing using the installed demo will get you a lot of hands on training.

Use the exam study guides.

Sitecore learning has study guides available that will go over what to expect in the test. These can be overwhelming because there is a lot of information in there. Try to get the overall idea of what is being explained so at least you can go back and remember if you need to retake the exam. Also the practice questions should be copied and memorized. They may not be on the exam, but be prepared just in case.

Create your own study guide.

I took notes on what I thought was important and TBH whenever I failed an exam I quickly jotted down questions I knew I struggled with. The exam results will also tell you what you should study more. Making you own study guide not only gives you something to refer to, but you can use it for future use when you are happily using the Content Hub.

Use multiple choice strategies.

This is always better said than done. However you have four answers to choose from. I found at least two answers didn’t make sense. So I tried to eliminate those. The last two you really need to figure out which one the answer should be. Look into the question for help, but also look at other questions that may also give you clues. At the end of the day if you can’t decide, choose the one that makes the most logical sense.

Understand how taxonomy and relationship works.

You have been exposed to this throughout your career. The content hub is no different. One thing though I want to stress is think of the taxonomy type as a parent to the asset. Not the other way around. This is important because you want to think about how different things relate to each other. For instance a taxonomy has a one to many relationship with assets. Think about other things that relate to each other and how many things would relate back and forth. Could be many to many. Also a rule of thumb is taxonomies and security go hand in hand.

Understand how workflows work.

You have been using workflows in Sitecore and in content hub they really are not that different. Get familiar with the way content hub does workflows. I promise it is not much different than how Sitecore does it.

Spend time in the setting settings in the content hub sandbox.

This is important as you will use a lot of the different tools here. Make sure you look at triggers, schemas, actions etc… You will need to understand why and where you would use them.

Learn about in process vs background process and when/not to use them.

In Process – is necessary when you need immediate feedback for the user interface.Nothing else will be executed until In Process is finished.

In Background – by default a script must be set to background processing. This makes it run behind the scenes without user interaction.

Look at the action scripts in the demo of Content Hub.

Try and understand how data is passed back and forth. See how the scripts interact with various internal an external components.

Take the Sitecore Training and Exam Prep

I highly recommend taking any Sitecore training offered. Make sure you make a connection to the instructor and give them any feedback after taking the exam. Not everything will be on the exam taught in the class, but you will be better prepared.

Breathe and Relax.

I am getting better at this. I tend to be nervous going into any test I take. I soon relax as the test goes on. I tend to get a little anxious when I don’t have a clear answer to questions. Just breathing and relaxing really does help. Just don’t breathe too loud because the microphone may pick it up and the exam could get paused. 🙂 The answer is there, just reread the question and again make the logical choice.

Conclusion

No matter what happens don’t give up trying. If you fail, learn from it and don’t be worried about taking the exam again. I always recommend taking the training and exam prep offered by Sitecore.

Sitecore Branch Templates: Simplifying Content Creation

This is part of my back to basics series of blogs. One of the things that I have come across in different Sitecore site installs that are critical for content authors is branch templates. Branch templates have been around quite a while in Sitecore. Although Experience Editor is popular and branch templates work in Experience Editor a lot of content authors still use the Content Editor exclusively. Utilizing branch templates will make the process smoother when creating content and better guide the content authors.

So the best way to explain how branches work is to think of them as a tree. You have the trunk which would be the item you want to create, but then you have the branches that help the tree grow and help define what kind of tree it is, but most of all help feed the tree. For example a vehicle sticker. Vehicles can come with different options, different colors, etc… Each vehicle is different too and there would be options just for that vehicle and not other vehicles. Just for fun I drew a picture on my iPad to explain it visually. 🙂

Drawn on my iPad.

Branch Templates – How to Create and Use Them

Branch templates are usually created under /sitecore/templates/Branches. Right clicking on the Branches folder you will be prompted to pick a template.

After choosing a template you can add different templates underneath. In the instance below I created a branch for a vehicle sticker item. $name is the vehicle sticker template and what you see underneath is the supporting templates and template folders.

Now just set the insert options where you want the branch template and then you will get a new vehicle sticker item created with all of the supporting templates. Keep in mind all the presentation layer settings will be the same as it would be if you just inserted the vehicle sticker item.

After setting the branch template for the insert options. You will see the following after you insert the new branch template on the content tree.

Conclusion

So there you have it. The basics of a branch template. I believe this is one of the more critical features to implement when creating a Sitecore site. It will ensure content is created correctly from the start. Now that being said with newer versions of SXA, Page Branches were introduced. I will be covering that concept in the future. Regardless you can still choose to use branch templates.

#Sitecore 10.4 is Here

You will probably see a lot of blogs about the new release. I wanted to highlight some of the things that pertain to clients and content authors that I know makes this release exciting and will have clients wanting to upgrade based on my experience.

Content Editor

One of things I know is big with our client is accessibility. Not only for a website, but for content entry as well. The content editor gets some great exciting new updates:

  • Easier expand items on the content tree.
  • Content area selecting fields is easier.
  • W3C ARIA Authoring Practices Guide, enabling users to seamlessly navigate with a keyboard through ribbons, the content tree, and various field types.
  • Able to listen to information about UI elements through assistive technology.

Example of an item that the tab stop has landed on:

Tabbing example:

SaaS Product Integration

Many clients are not ready to go full XM Cloud. However now you can have the best of both worlds.

  • A new migration tool that can be used to migrate content, media and users from an XM instance to an XM Cloud instance.
  • A new migration tool to transfer xDB to CDP. This can include contact facets for CDP, Personalize and also Sitecore Connect to external systems. Having this in place will help make the jump to a full SaaS environment when a company is read.

Miscellaneous Updates (copied from the release notes)

  • Added audit logging for Sitecore logins via Identity Server.
  • Added audit logging when unlocking an item in the Content Editor Review tab – My Items.
  • Added a new module called Codeless Schema Extension, enabling business users to extend the xConnect schema without requiring code development.
  • You can now target specific audiences more effectively by adding custom languages, combining any ISO language code with a country/region code. This includes the ability to use nonstandard country/region codes, such en-EU.
  • Added the ability to create a custom or regional language directly in the Content Editor, such as en-EU, which extends beyond those ISO language formats that are registered in .NET.

More Information

There are a lot of major/minor changes with this release. To find out more and how to download the latest version of Sitecore follow this link.

#Sitecore Templates Back to Basics

We see a lot of blogs on cool things, but what I believe is missing lately are blogs on the basics of Sitecore. It has also been mentioned in the Sitecore community that we don’t have enough blog posts about the basics. So I will be doing more of these. Ironically. recently I have been holding training sessions with my colleagues at RBA. They are in roles such as QA, Strategist and Front-End development. All of them need to use Sitecore, but really don’t know the what and why Sitecore is the way it is.

I wanted to start with Templates. How I present this will be a little technical, but most of it will be broken down for easier understanding. Keep in mind this blog is geared towards the non back-end developers, but will be somewhat technical. This should give someone a basic understanding of Sitecore templates.

To explain how templates work I want to use a car as an analogy. Lets say we need to create a window sticker for a car. What fields would you need to do that?

On a window sticker you would probably see something like this.

Standard Details

  • VIN
  • Interior Color
  • Exterior Color
  • Standard Equipment
  • Options
  • Price
  • Etc…

Optional Equipment

  • Options Selected

In order to store this information we would need some sort of data structure. That is where a Sitecore template comes in to play. A template would have fields defined in order to create a window sticker item that will hold the information needed. Using this template we can create multiple window sticker items. Items btw as you can guess are created from templates. Everything you see in Sitecore is basically an item.

Template Creation

We are going to start with a simple template creation. In the Sitecore content tree the templates are usually found in the [might have a path here]/sitecore/templates folder. If you need to ever find a template for an item quickly you will see the path in the item Quick Info section. Even the Templates folder is made up of a template. See the example below.

Moving on to template creation. Typically a developer would create a new template by right clicking on one of the sections in the templates folder. For most of you reading this basic guide you don’t have to worry to much about it, but if you are curious or a new developer in the Sitecore world. This is what you will see.

We will just create a new template under User Defined. When creating a new template we will just use the default standard template. The name will be Window Sticker.

After it is created you will see several sections. For this blog on basics though we will just mainly be concerned about the Builder tab up on top. When clicking that you will see the following.

This is where we will defined the data structure for the Window Sticker item. Templates allow you to group common fields in sections. In this example we have a Standard Details section and a Options section. Each have their own fields defined. The Type of field should be determined by the most user friendly option for content entry.

Item Creation

After a template is created it usually inserted by right clicking on the item in the content tree you want to insert it under. In this case using the template created above we created a Window Sticker Item. You will see the following fields in the item. As you can see the fields we created in the template is present on the item create from the template. The Template path in the Quick Info section will take you to the template of the item if you need to make some edits.

Inheritance

One last thing to go over. One of the most powerful things about Sitecore templates is that they can inherit from other templates. So what does that mean? Well suppose you had an address section on several templates. You only need to create one address template and the other templates that need to use the same field can inherit from that template. When the item is created from the template that contains the inherited template the item will not only have the template fields, but the inherited ones too.

For instance let’s create a template called Factory Address.

The Window Sticker will inherit the Factory Address template. By default it already inherits the Standard template.

So now when you view the item created with the Window Sticker template you will see the Factory Address section.

Wrap Up

So I hope I gave you a basic understanding how Sitecore templates are created. There are many settings on them you can play around with, but for those that are non-technical I hope this gave you a basic understanding of them. Please reach out to me if you have any questions.

Using #Sitecore SXA Variants With a Single View

Let me start out by saying I felt this was a good route to take although may not be everyone’s first choice. There are more than one way to accomplish things correct? Here is how I do it.

What is a Variant?

A variant in SXA allows you to change the rendering output to display differently as needed. You can learn more about them by clicking here.

How to Setup a Variant

In SXA you will find the variants under /sitecore/content/[path]/Presentation/Rendering Variants. You will want to create a Variants parent item (/sitecore/templates/Foundation/Experience Accelerator/Rendering Variants/Variants) and underneath Variant Definition items (/sitecore/templates/Foundation/Experience Accelerator/Rendering Variants/Variant Definition). It is very important to name the Variants parent item the same name as your rendering that you will create. That is how SXA ties them together.

When adding the component to the page you will see the variants added.

The Code

In the view model we will inherit from the VariantsRenderingModel.

public class SuperfnaturalViewModel: VariantsRenderingModel
    {
         public string RenderingVariant { get; set; }

    }

The repository will inherit from the VariantsRepository. Using the method FillBaseProperties the necessary information to retrieve the variant information will be added to the model.

internal class SupernaturalRepository : VariantsRepository, ISupernaturalRepository
    {
        public override IRenderingModelBase GetModel()
        {
            SupernaturalViewModel supernaturalViewModel = new SupernaturalViewModel();

            FillBaseProperties(supernaturalCardsViewModel);
           
            return SupernaturalViewModel;
        }
    }

In the view we will get the selected variant using the FieldNames value (can also set this value in a variable in the view model). I know not the name (FieldNames?) I expected either.

string VariantGuid = Model.Rendering.Parameters["FieldNames"];

Checking What was Selected

Check default or if nothing is seletected.

@if (Constants.SupernaturalVariants.Default == VariantGuid || string.IsNullOrEmpty(VariantGuid))

View code goes here, you know HTML.

Check for the image left variant.

@if (Constants.SupernaturalVariants.ImageLeft == VariantGuid)

View code goes here, you know HTML.

Final Thoughts

Lots of ways to do this I am sure, but this was something I was familiar with and pretty easy for others to use in my opinion. There may be a better way, but as Adam Sandler says.

Adding Buckets with Rules to #Sitecore SXA Explained

It has been awhile since I created buckets in Sitecore and last time I did might of been before SXA was released. After some help from the Sitecore community here are the steps I took.

Create Bucketable Template

On the standard values of the template I wanted to be part of the bucket under the Configure ribbon I clicked on Bucket.

Make Sure you Keep Parent Child Relationship

The following was important and was something that was overlooked at first. On the Standard values on the same template you set the Configuration for Buckets the following had to be checked. Bucketable and Lock child relationship. The lock is really important so you don’t lose any child folders such as the Data folder. You will never find it again if you don’t.

Add Setting with Rules

Now we need to decide on folder structure and how we assign the bucket rule. To be honest I don’t remember doing this pre SXA days. Anyway rule was simple. What is important is the format. In this case I wanted yyyy/MMMM.

/sitecore/system/Settings/Buckets/Item Buckets Settings

Set the Parent Bucket

For lack of a better term it is important that you set the parent item that the bucket items will go under as bucket.

Final Results

When you right click you will now notice when you insert an item it will be stored in a bucket folder structure and the Data folder will be with it. On a side note I did use a Page Branch in order to create the structure of the item being inserted. More about those later.

Buckets are the Perfect Tool for Any Job

Getting Started Quickly with #Sitecore CDP (Customer Data Platform)

Sitecore CDP formerly Boxever is something you are probably hearing a lot about these days. As a developer you can implement it easily and as a marketer you can take advantage of some of the features as soon as it is implemented. Here are the steps in order I did to get started.

1. Get a sandbox account.

Should be able to get a login for the CDB Sandbox from your Sitecore rep. You can find the sandbox site here. This is a shared sandbox so you will need to be careful not to change anything that someone else has setup. It is ok to look and see what others have setup. That is one advantage of a shared sandbox.

When you first login to your sandbox account you should see a message like this:

2. Get your keys and Create Point of Sale Value.

To get your keys go to the gear icon at the bottom left and select System Settings then API Access.

Copy both keys. Please note in my example I did not use the API Token.

3. Create Point of Sale

Selected System Setting then Point of Sale. Click on the create button and fill out the required fields. In my case since I am using the Lighthouse Demo I called my POS LighthousePOS. Well I can’t remember if I created or it was already out there.

4. Implement code. (SXA Example)

The next step is to implement the script needed to integrate CDP with your site. The script should look like the following. As of this blog the target version should be 1.2 and s.src should be 1.4.8. You will need to add your client key.

// Define the Boxever queue
   var _boxeverq = _boxeverq || [];
   // Define the Boxever settings
   var _boxever_settings = {
       client_key: 'client key goes here', // Replace with your client key
       target: 'https://api.boxever.com/v1.2', // Replace with your API target endpoint specific to your data center region
       cookie_domain: '.lighthouse.localhost', // Replace with the top level cookie domain of the website that is being integrated e.g ".example.com" and not "www.example.com"
       pointOfSale: "LighthousePOS",
       web_flow_target: "https://d35vb5cccm4xzp.cloudfront.net"
};
   // Import the Boxever library asynchronously
   (function() {
        var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
        s.src = 'https://d1mj578wat5n4o.cloudfront.net/boxever-1.4.8.min.js';
        var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
    })();

I kept this pretty simple and for now created a script and put it under the Base Themes\Main Theme\Scripts folder. I created a script item called cdp-script.

5. Create an Experiment

From the menu expand Experiments and choose Web. Click on the Create Experiment button.

From there you want to click on the add variant button.

After you click on Add Variant there will be a side menu that will appear. Choose My Library Templates.

We will choose a simple popup takeover.

Change anything you want to. In this case I changed the background and font colors. You can also change HTML and script

Once done, make sure you click on the Save button then Close when you see the checkmark.

You will see the new Popup in a list. Click on the Preview button, enter in your site with the CDP script and click the go button. If everything worked correctly you should see the popup.

Once the site opens, in this case my local demo site you will see the popup created.

Another option to try is Experiences the setup is similar to Experiments. You can find on the same menu as Experiments.

This should get you started. I would take a look at what others have done since it is a public sandbox. There are a lot of possibilities with CDP and we are only scratching the surface. For more information on getting started please take a look at this video that was released as I was putting together this blog.

#Sitecore #Docker Containers Syncing Database Changes the Lazy Way

I have been using Docker/Containers for about six months. I have to tell you I really like using them. A recent project I am helping architect the solution for I decided to have the other developers use them. There were some hiccups along the way getting some developers setup, but so far it has worked out well. I think I convinced them change is good.

Ted Lasso Memes At Your Service!

Anyway one of the things I have learned is how easy it is to deploy things to containers. One of them being databases. Normally you would install Sitecore and serialize items or use Sitecore packages for changes. We are doing that. However we had multiple sites/tenants to create in SXA and wanted to make sure the team was in sync from the start. With the out of the box Sitecore tools for Docker it is easy to do.

If you look into your docker\data\mssql folder (could be a different folder depending how you setup your volume, but in this case I am using the default) you will find the ldf and mdf files for each Sitecore database. Just copy the ones for the database you want to share and put it in a shared folder for other developers. I actually stored them in Teams.

The developer who is installing the database should do a docker-compose down first. Then copy the database files to their local data\mssql folder. Once they are a copied to the other developer’s local data\mssql folder they will need to do a docker-compose up. Now they will have the same database changes as the other developer for their containerized Sitecore instance. BTW inside the mssql image you can view the database files.

So what happened? Was it magic? Well if you think PowerShell is magic then it was. As with custom web changes databases are also deployed into the images using the built in Sitecore tools. So as soon as the files are copied the watcher does its thing.

So one catch with this that I noticed recently. If you clean out your Docker Data\Deploy folders by running something like the clean.ps1 script it clears out the data\mssql folder. Which means the database changes could be lost. I will look for a workaround for this, but one thing that I did was create a clean script that keeps the database folder contents. See below for an example:

# Clean data folders
Get-ChildItem -Path (Join-Path $PSScriptRoot "\docker\data") -Directory | ForEach-Object {
    $dataPath = $_.FullName

    Get-ChildItem -Path $dataPath -Exclude ".gitkeep", "license.xml", "*.ldf", "*.mdf" -Recurse | Remove-Item -Force -Recurse -Verbose
}

# Clean deploy folders
Get-ChildItem -Path (Join-Path $PSScriptRoot "\docker\deploy") -Directory | ForEach-Object {
    $deployPath = $_.FullName

    Get-ChildItem -Path $deployPath -Exclude ".gitkeep", "license.xml", "*.ldf", "*.mdf" -Recurse | Remove-Item -Force -Recurse -Verbose
}

I will update this blog post I am sure as things evolve with Docker/Containers, but I hope for now this will give one way to share database changes. If you have a better way I would love to know.

Basic Authentication with #Sitecore 9.3

A few months back I was given a task to put in basic authentication into Sitecore 9.3. It was mainly from preventing anyone to get into staging sites. I came across and older blog that is currently missing. I wanted to give them credit since it was the inspiration for this blog. You can find the original blog post on the web archives here. I have made some of my own updates including Rules Based Configuration.

using System;
using System.Web;
using Sitecore.Diagnostics;
using Sitecore.Pipelines.HttpRequest;
using System.Text;
using System.Net.Http.Headers;
using System.Linq;

namespace Abc.SharedSource.SitecoreProcessors
{
    public class BasicAuthentication : HttpRequestProcessor
    {
        private bool CheckPassword(string username, string password)
        {
            string[] userlist = Sitecore.Configuration.Settings.GetSetting("BasicAuthUsername").Split(',');
            string[] passwords = Sitecore.Configuration.Settings.GetSetting("BasicAuthPassword").Split(',');

            if(userlist.Contains(username) && passwords.Contains(password))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        private void AuthenticateUser(string credentials)
        {
            try
            {
                var encoding = Encoding.GetEncoding("iso-8859-1");
                credentials = encoding.GetString(Convert.FromBase64String(credentials));

                int separator = credentials.IndexOf(':');
                string name = credentials.Substring(0, separator);
                string password = credentials.Substring(separator + 1);
             
                if (!CheckPassword(name, password))
                {
                    HttpContext.Current.Response.StatusCode = 401;
                }
            }
            catch
            {
                HttpContext.Current.Response.StatusCode = 401;
            }
        }
        //Basic Auth Code End

        public override void Process(HttpRequestArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (Sitecore.Context.Item != null || Sitecore.Context.Database == null || args.Url.ItemPath.Length == 0)
                return;

            if (Sitecore.Configuration.Settings.GetSetting("TurnonBasicAuth") != "True" || Sitecore.Configuration.Settings.GetSetting("TurnonBasicAuth") == "") return;
            if (PatternMatch()) return;
            var request = args.HttpContext.Request;

            var authHeader = request.Headers["Authorization"];
            if (authHeader != null)
            {
                var authHeaderVal = AuthenticationHeaderValue.Parse(authHeader);

                // RFC 2617 sec 1.2, "scheme" name is case-insensitive
                if (authHeaderVal.Scheme.Equals("basic",
                        StringComparison.OrdinalIgnoreCase) &&
                    authHeaderVal.Parameter != null)
                {
                    AuthenticateUser(authHeaderVal.Parameter);
                }
            }
            else
            {
                args.HttpContext.Response.StatusCode = 401;
            }

            if (HttpContext.Current.Response.StatusCode == 401)
            {
                string Realm = Sitecore.Context.Site.TargetHostName;//HttpContext.Current.Request.Url.AbsoluteUri;
                args.HttpContext.Response.Clear();
                args.HttpContext.Response.Headers.Add("WWW-Authenticate",
                    string.Format("Basic realm=\"{0}\"", Realm));
                args.HttpContext.Response.Flush();
                args.HttpContext.Response.End();
            }
        }
        bool PatternMatch()
        {         
            string[] mockUrls = Sitecore.Configuration.Settings.GetSetting("ExcludedPaths").Split(',');
            string url = Sitecore.Context.Site.TargetHostName;// HttpContext.Current.Request.Url.AbsoluteUri;
            foreach (var urlval in mockUrls)
            {
                var containsurl = url.Contains(urlval);
                if(containsurl)
                {
                    return true;
                }
            }
            return false;
        }
    }
}

Since this is Sitecore 9.3 the configuration below is using rules based. 🙂 More than likely you would want to require the ContentManagement role, but you can modify the configuration to use any roles and environments. I put the username and settings in the configuration since Sitecore will also have its own and in this case is only for preventing anyone who accidently finds the site from seeing anything.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:localenv="http://www.sitecore.net/xmlconfig/localenv/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="ContentManagement, Standalone">
    <pipelines localenv:require="DevBuild or LocalDeveloper">
      <httpRequestBegin>
        <processor type="Abc.SharedSource.SitecoreProcessors.BasicAuthentication, BrookfieldResidential.Extensions"
						   patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.UserResolver, Sitecore.Kernel']"/>
      </httpRequestBegin>
    </pipelines>
    <settings localenv:require="DevBuild or LocalDeveloper">
      <setting name="TurnonBasicAuth" value="True"></setting>
      <setting name="ExcludedPaths" value="media,layouts,speak,/sitecore,/sitecore/admin,brpsc.dev.local/about" />
      <setting name="BasicAuthUsername" value="UserTest1,TestUser2,TesUser3" />
      <setting name="BasicAuthPassword" value="testpass1,testpass2,testpass3" />
    </settings>
  </sitecore>
</configuration>

You should then get the default login screen that looks like this: