Skip to content

Instantly share code, notes, and snippets.

View chrsin's full-sized avatar

Christian Sindberg Oddershede chrsin

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Web.Http;
using Sitecore.Services.Core.Security;
using Sitecore.Services.Infrastructure.Web.Http.Security;
namespace MyWebsite
{
[RoutePrefix("_api/TAuth")]
using System.Diagnostics.CodeAnalysis;
using System.Web.Http;
using Sitecore.Pipelines;
namespace MyWebsite
{
[ExcludeFromCodeCoverage]
public class CustomMvcRoutes
{
public void Process(PipelineArgs args)
using System.Diagnostics.CodeAnalysis;
using System.Web;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using ActionFilterAttribute = System.Web.Http.Filters.ActionFilterAttribute;
namespace MyWebsite
{
[ExcludeFromCodeCoverage]
public class RemoveCookiesFilterAttribute : ActionFilterAttribute
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Security.Claims;
using System.Text.RegularExpressions;
using Sitecore;
using Sitecore.Pipelines.HttpRequest;
using Sitecore.Security.Authentication;
using Sitecore.Services.Infrastructure.Web.Http.Security;
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="MyWebsite.WebApiSetup, MyWebsite" patch:after="processor[@type='Sitecore.Pipelines.Loader.EnsureAnonymousUsers, Sitecore.Kernel']" />
</initialize>
</pipelines>
</sitecore>
</configuration>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Sitecore.Services.Token.Authorization.Enabled">
<patch:attribute name="value">true</patch:attribute>
</setting>
<setting name="Sitecore.Services.SecurityPolicy">
<patch:attribute name="value">Sitecore.Services.Infrastructure.Web.Http.Security.ServicesOnPolicy, Sitecore.Services.Infrastructure</patch:attribute>
</setting>
<setting name="Sitecore.Services.Token.Authorization.Timeout">