Posts

Showing posts from October, 2018

WordPress blogs migration with Sitecore Data Exchange Framework (DEF)

Image
A couple of months ago I gave a talk for the Sitecore User Group Ecuador. As part of the talk I presented a POC (it's actually more than just a POC), which consisted in migrating existing WordPress blogs into a Sitecore instance. Throughout this post I will explain what I did to achieve this using DEF. However, I won't delve into the intrinsic details of how DEF works since there are plenty of resources in the internet. At the end of the post you will find a link to Github with the code.

DEF uses a set of items (endpoints, pipeline steps, pipeline batches, etc) to integrate with other systems. This POC is composed of:
One EndpointOne Pipeline BatchOne PipelineSix Pipeline Steps  Endpoint: 
An endpoint in DEF is an item that holds the configurations for an integration, in this case, the endpoint contains the URLs from where we are going to retrieve the posts/tags/categories:



This endpoint item uses a custom template that inherits from the DEF "Base Endpoint" template an…

Basic Auth with Sitecore

A custom attribute can be created in order to support Basic Auth with a custom API. The end goal is to be able to use a new AuthorizeAccess attribute like this:

namespace xxx.xxx.xxx { [AuthorizeAccess(Role = @"ROLENAME")] public class TestController : ServicesApiController { [HttpGet] public IHttpActionResult FetchItem(string identifier) { var contentItem = GET ITEM BASED ON THE IDENTIFIER; if (contentItem != null) { return Ok(contentItem); } return Content(HttpStatusCode.NotFound, "Item not found"); } } }
This new AuthorizeAccess attribute has a parameter called Role which accepts Sitecore roles and can be placed at the class or the action levels depending on the requirement. The goal is to return a 404 status code if the request comes with an authorization header (username:password base64 encoded) that does not belong to the specified role.

Let's …