0

I have not added my custom domain in Domains.config. I'm able to create the users programmatically by passing the domain name as a hardcoded string to the method.

The users are listed in User Manager.

So, is it mandatory to have the custom domain declaration in Domains.config.

Using Sitecore 10.2

3
  • I was able to build a way to deploy patches that include the domain. sitecore.stackexchange.com/a/2033/95 Feb 2 at 15:16
  • @MichaelWest I'm able to create the users without any of that. Could you please tell me, is that okay? Will it fail in any use case.
    – sukesh
    Feb 2 at 15:17
  • Management of the domains is only needed when adding something new. For example, you don't want the user to be in the "sitecore" domain but instead you want "qwerty\superuser". As long as you are using domains that "exist" then creating users programmatically is fine. Feb 2 at 16:18

3 Answers 3

3

It is not necessary, but if you are creating a user by passing a domain that doesn't exists in the domains.config then the user will be created but the domain entry for this will remain blank.

I have created a user called myuser1 by passing a hardcoded domain called 'rbtest' that is not listed in domains.config. So when I see the user in the user manager then it shows but as a blank entry in the domain column.

enter image description here

On the other way when I create a user by passing the domain that exists in domains.config called myuser with the domain called sitecore, then it shows the domain entry like this.

enter image description here

So note that the domain column on UI is fulfilled only if an existing domain is specified.

Hope this makes sense.

1

You can use security domains to manage user's access to different parts of Sitecore, for example, if you have multiple websites within a single system.

A Sitecore domain is a collection of security accounts (users and roles) that you can administer as a unit with common rules and procedures. A domain is used to collect security accounts that have some logical relationship, for example, all the accounts that have access to use the Sitecore clients could be stored in the Sitecore domain, whereas all the accounts with access to the published website could be stored in the Extranet domain.

If you are using existing domains then creating users programmatically is fine.

But by adding a custom domain, you can have your users in the custom domain, and you can distinguish between them, also it will be easy to manage them as well.

0

A Sitecore domain is a collection of security accounts (users and roles) that works as a single atomic unit to perform allowed activities. To give example

  1. All the accounts with access to the published website could be stored in the extranet domain
  2. All the accounts that have access to use the Sitecore clients could be stored in the Sitecore domain.

Sitecore contains mainly 3 types of domains.

  1. Extranet – This domain has user accounts corresponding to the visitors of the website. It may also contain customized roles that manage read access to the content of the website. Members of this domain can have additional roles like Client authoring roles in which case they can edit the content also.
  2. Sitecore - This is for internal users who provide access to Sitecore Client roles. This domain can also have customized roles. Users of this domain can access the extranet domain also based on the login page.
  3. Default - This is a virtual domain that only exists in memory. This domain is used in case the website does not specify the default domain and then users are set to default\anonymous otherwise these users will be of account extranet\anonymous whenever they visit the site. In this case Sitecore.Context.User.IsAuthenticated returns false.

Now, coming to your question, I'd recommend setting up the domain as best practice to avoid any hiccups in the future. You can efficiently use security domains to manage user access to different parts of Sitecore.

Referance link: https://www.linkedin.com/pulse/what-importance-security-domains-sitecore-rohit-chopra

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.