Umbraco Community Runtime Validators

This is a short but sweet blog post, to let you know about the Umbraco Community Runtime Validators package is out and available for you to use.

This little package came about working with the lovely lot over at Gibe Digital and I suggested that perhaps the code for a specific client project be reused and turned into this project where the wider Umbraco community can benefit from it.

So a BIG thanks to the Gibe development team for peer reviewing the work and collaborating with me on it.

What is an Umbraco Runtime Validator?

This is some code that can run to determine if the Umbraco environment is configured correctly, typically for a Production environment and prevent it from booting and giving you a verbose reason as to why. This makes sure you have all the optimal settings needed to run your Umbraco site in a production environment.

Umbraco ships with the following Runtime Validators to help make your site ready and optimal for use in production.

  • JITOptimizer
    The application is built and published in Release mode (with JIT optimization enabled)
  • ModelsBuilderMode
    The config value Umbraco:CMS:ModelsBuilder:ModelsMode is set to Nothing
  • RuntimeMinfication
    The config value Umbraco:CMS:RuntimeMinification:CacheBuster is set to a fixed cache buster like Version or AppDomain
  • UmbracoApplicationUrl
    The config value Umbraco:CMS:WebRouting:UmbracoApplicationUrl is configured
  • UseHttps
    The config value Umbraco:CMS:Global:UseHttps is set to true

To learn more about Runtime Validators you can read the official documentation on what they are and how to write your own Umbraco Runtime Validator.

What’s in Umbraco Community Runtime Validators ?

This first release out to the wild, focuses on ensuring your production environment is configured correctly if you are hosting your Umbraco site in Azure in a load balanced environment and ships these Runtime Validators

Alright already… just tell me how to set it up

Well you can find the package over on Umbraco Marketplace with a lovely readme on how to get setup and running.

But the quick TL:DR version is

dotnet add package Umbraco.Community.RuntimeValidators

Create an Umbraco Composer that updates the RuntimeModeValidators collection

using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Community.RuntimeValidators.Validators.AzureLoadBalancing;
using Umbraco.Extensions;

namespace YourProject.Website

public class RuntimeValidatorsComposer : IComposer
{
	public void Compose(IUmbracoBuilder builder)
	{
		builder.RuntimeModeValidators()
			.Add<TempFilesValidator>()
			.Add<HostSyncValidator>()
			.Add<ExamineValidator>();
	}
}

Got an idea for a Runtime Validator

Then please submit an issue on the GitHub repository with your super duper fab idea and lets get the conversation going and have a useful community repo of Runtime Validators to make all our Umbraco sites that much better !

Securing Umbraco Web APIs using JSON Web Tokens

Hello all,
First off a very happy new year to you all. I hope you had a good time off over the festive period and relaxed.

Over this festive period in between our baby girl arriving during late night feeds and insomnia kicking in, I managed to find a little time to polish off my new pet project for the wonderful Umbraco CMS. So I herby introduce you to UmbracoAuthTokens!

What is Umbraco Auth Tokens?

Umbraco Auth Tokens is a project that I have built that allows you to secure Umbraco WebAPI Controllers using a token based authentication using JSON Web Tokens aka JWT; pronounced jot. This is ideal for securing WebAPIs that require using a backoffice Umbraco user.

For example you may want to securely from a third party client be it a mobile application or similar create a new page or any other action that a backofficer Umbraco user may do.

What are JWTs?

They are an auth token that allows you to send a piece of JSON encoded as a token and are the more modern approach to deal with auth in applications especially as we build applications across different devices. The videos below will do a lot better trying to explain it than I can do.

Continue reading Securing Umbraco Web APIs using JSON Web Tokens