Sitecore.Context.User.IsAuthenticated returns true for extranet\Anonymous user - sitecore

I have Sitecore 6.6 installed. I wanted to add a new domain to Sitecore; Since my Sitecore instance is deployed in two servers with two Sitecore sites in each pointing to different web databases but same core, master and analytics databases, I couldn't do it using Sitecore Domain manager.So I thought of doing it manually by editting the App_Config\Security\domains.config in the server. The following was the domains.config that I had.
<?xml version="1.0" encoding="utf-8"?>
<domains xmlns:sc="Sitecore">
<domain name="sitecore" ensureAnonymousUser="false" />
<domain name="extranet" defaultProfileItemId="{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}" />
<domain name="default" isDefault="true" />
<sc:templates>
<domain type="Sitecore.Security.Domains.Domain, Sitecore.Kernel">
<ensureAnonymousUser>true</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
</domain>
</sc:templates>
<domain name="Station" defaultProfileItemId="{F181ED3D-F342-46E6-B6F6-2A6A6173B513}" />
<domain name="Emailcampaign" />
</domains>
I added one more domain(MyDomain) at the end like below.
<?xml version="1.0" encoding="utf-8"?>
<domains xmlns:sc="Sitecore">
<domain name="sitecore" ensureAnonymousUser="false" />
<domain name="extranet" defaultProfileItemId="{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}" />
<domain name="default" isDefault="true" />
<sc:templates>
<domain type="Sitecore.Security.Domains.Domain, Sitecore.Kernel">
<ensureAnonymousUser>true</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
</domain>
</sc:templates>
<domain name="Station" defaultProfileItemId="{F181ED3D-F342-46E6-B6F6-2A6A6173B513}" />
<domain name="Emailcampaign" />
<domain name="MyDomain" />
</domains>
As soon as I did that, Sitecore.Context.User.IsAuthenticated started returning true for extranet\Anonymous user(Non-logged in user) in the code.
Has anyone faced this issue before?
Please let me know where am I going wrong.

I also encounted this issue back when I was working with Sitecore 6.6, I'm not certain if its an issue in later versions. Essentially when you modified your domains.config with the param ensureAnonymousUser set to true the Anonymous User for that domain, in this case Extranet, was created in the database - it may not have been until you changed that setting.
In Sitecore all non-logged in users view the site as the user *domain*/anonymous. As Sitecore's membership is based on .NET Membership it determines that the User is logged in as its using that account.
Therefore I recommend completing an additional check with your Sitecore.Context.User.IsAuthenticated to check if the username of User's account is *domain of site*/anonymous, Sitecore.Context.User.Name, if it is return false.
EDIT
I have confirmed Sitecore.Context.User.IsAuthenticated returning true for *domain*\Anonymous user has been fixed in Sitecore 8. Therefore you can use it to determine if the User is logged in and not using the *domain*\anonymous account.

We finally resolved this issue! This was caused by a fix we added to solve an issue we had with Sitecore ECM. The issue was that Sitecore used to log out as soon as we clicked on the message preview. So we followed the steps given in the below thread to fix the issue.
https://stackoverflow.com/a/30836600/4165670
But we were not testing for Anonymous user like it is done in the thread. We never pushed this code into Content Delivery site and when
we created the new domain, This code got pushed into the Content Delivery site with some other code.
Since we are setting the current user as the Active user in the code, it started showing that extranet\Anonymous user as the current user.

Related

how can I deeplink an app from Google Assistant?

I'm creating a dialogflow agent integrated with Google Assistant.
What I'd like to do is to open an app (my app) when a proper intent is matched. I've seen that actions like Youtube, Spotify etc. are able to do that, for example I can tell the Youtube action "search for cats video" and the Youtube app will open with a list of cats videos.
I tried to use the DeepLink class but I then noticed it's deprecated.
DeepLink class
Is there any way you can suggest me to do this?
Thanks in advance
I think you are looking for App Actions. Here are the steps you need to follow:
Find the right built-in intent. actions.intent.OPEN_APP_FEATURE should be the right one for you.
Create and update actions.xml. It should look like
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet" />
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms" />
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms" />
</entity-set>
</actions>

Sitecore 8.1 Update 2 - URL's can't be generated from display name

We upgraded our solution from Sitecore 8.1 Update 1 to Update 2. Our URL's are generated from display name and that was working fine.
But after upgrading, the behaviour changed to URL generation from item name although ShowConfig.aspx still shows "useDisplayName="true" for .
We're using the following config:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<linkManager defaultProvider="sitecore">
<providers>
<clear/>
<add name="sitecore">
<patch:attribute name="addAspxExtension">false</patch:attribute>
<patch:attribute name="useDisplayName">true</patch:attribute>
<patch:attribute name="languageEmbedding">never</patch:attribute>
<patch:attribute name="alwaysIncludeServerUrl">true</patch:attribute>
</add>
</providers>
</linkManager>
</sitecore>
Now all links only show a 404. What am I missing?
We tried on an empty solution and it's the same behaviour. So it is a Sitecore bug.
We contacted Sitecore Support. They introduced a new setting in Update 2 in Sitecore.config.
<setting name="ItemResolving.FindBestMatch" value="DeepScan" />
This setting needs to be set to:
<setting name="ItemResolving.FindBestMatch" value="Disabled" />
It was supposed to solve the following bug:
96805: Item could have been unresolved with specific encodeNameReplacement and wildcard/display name resolving logic
This is now registered as a bug with the reference number 105324.

Sitecore 8.1 Upgrade Media section broken

I upgraded sitecore from 7.0 to 8.1. The only real problem I have ran into is the media section is broken and the images appear broken on the site itself.
The weird part and I can upload and download the media items. It is broken in both chrome and firefox.
Thanks]1
Update
<encodeNameReplacements>
<replace mode="on" find="&" replaceWith=",-a-," />
<replace mode="on" find="?" replaceWith=",-q-," />
<replace mode="on" find="/" replaceWith=",-s-," />
<replace mode="on" find="*" replaceWith=",-w-," />
<replace mode="on" find="." replaceWith=",-d-," />
<replace mode="on" find=":" replaceWith=",-c-," />
</encodeNameReplacements>
It looks like a problem with Sitecore Media Protection (included first time in Sitecore 7.5).
You can read more about it in Adam blog post "Do not turn Sitecore Media Request protection off and protect older Sitecore versions with ImageGuard".
But I don't know why hashes are not added to the links in Sitecore. It should be disabled for the Sitecore internal sites (e.g. shell, login, etc).
Try to disable media protection by changing the config in /App_config/Include/Sitecore.Media.RequestProtection.config file and see if this is the reason of your problems.
Fixed it. It turns out the way sitecore is configured has changed a lot between 7-8.1. By adding
<sitecore configSource="App_Config\Sitecore.config" />
and removing the old section fixed the problem.
You are missing a replacement:
<replace mode="on" find=" " replaceWith="-" />
It can cause problems in images request, if you are using spaces in media item names.
Add it to your section
Another thing to see is if your CustomHandler section is like this:
<customHandlers>
<handler trigger="-/media/" handler="sitecore_media.ashx" />
<handler trigger="~/media/" handler="sitecore_media.ashx" />
<handler trigger="~/api/" handler="sitecore_api.ashx" />
<handler trigger="~/xaml/" handler="sitecore_xaml.ashx" />
<handler trigger="~/icon/" handler="sitecore_icon.ashx" />
<handler trigger="~/feed/" handler="sitecore_feed.ashx" />
</customHandlers>
This is the same of "Configuration Files Changes" especified by Sitecore Upgrade 8.1 IR
One of the new changes in 8.1 is the change of the default prefix from "~" to "-". It could be related to this prefix change. If you take the URLs that are getting a 404 and replace the ~ with a -, do the URLs to media work?

Cas Ticket Issue in Jmeter

I have a web application which uses CAS Ticket for user authentication purpose which is different for every login. I recorded the script in JMeter. Also I correlated the pages by filling up the Regular Expression Extractor as follows:
Recorded script has url: https://foo.com/j_spring_cas_security_check?ticket=ST-3101-QDTyjbbHoOHvgPMdRBIg-cas.
After applying all above I ran the script but got status fail displaying https://foo.com/j_spring_cas_security_check?ticket=Ticket_Not_Found.
It would be very helpful if someone could tell me what did I miss in my script?
There is two ways for this,
if you have multiple username and password and you can use those with Jmeter,
you can use those to generate CAS ST(Service ticket).
Another:
default when CAS create ticket, it can be just used for one time.
you have to change values in ticketExpirationPolicies.xml of your cas server
to use same ticket multiple times.
default location is:
WEB_INF/spring-configuration/ticketExpirationPolicies.xml
change this to if you want 50 users to use same ticket
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="1"
value="100000" />
</bean>
<bean id="grantingTicketExpirationPolicy" class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy">
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="0"
value="7200000" />
</bean>
Answer given by: VIVEK ADHIKARI
It seems that an error happened when fetching ticket value from url's parameter list. Maybe you can add a hidden field on your page and set its value from this parameter.
<input type="hidden" id="ticket_key" value="ST-3101-QDTyjbbHoOHvgPMdRBIg-cas" />
Then you can get it by Regular Extractor ticket_key=(.+)
Hope it helps.

Django RSS Feed has domain set to example.com

I am able to get an output for the rss feed but the domain in the item link is http://example.com instead of the domain that I used in Feed.link (http://www.mydomain.com/blog). What do I need to do to get "mydomain.com" instead of "example.com"?
Below is the generated rss feed:
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>MyDomain Blog</title>
<link>http://www.mydomain.com/blog</link>
<description>insights and new developments in creating Pushstack</description>
<atom:link href="http://example.com/blog/rss/" rel="self"></atom:link>
<language>en-us</language>
<lastBuildDate>Mon, 31 Jan 2011 19:41:42 -0000</lastBuildDate>
<item>
<title>Example</title>
<link>http://example.com/blog/example</link>
<description></description>
<guid>http://example.com/blog/example</guid>
</item>
</channel>
</rss>
Also, in the title of the browser (OS X Chrome) it says, "NameError at /blog/rss/". Not sure if that is something that always shows up or if something else is wrong.
example.com is the domain that is automatically inserted into the database via the Sites framework.
You can edit the site in the admin: http://yourserver.com/admin/sites/site/
That's correct. You can also update it directly from the DDBB from "django_site" table, in case you are not using the admin.
Regards,
Martin
The atom:link value defaults to the information in the Sites framework, but you can override it by setting a feed_link property in your feed class, eg:
feed_link = "http://www.mydomain.com/blog/rss"