Book Image

Mastering ServiceStack

By : Andreas Niedermair
Book Image

Mastering ServiceStack

By: Andreas Niedermair

Overview of this book

Table of Contents (13 chapters)

Look left and right


Additionally, apart from the basic usage of the introduced Message Queues, you can further advance the implementations, which is reflected in this final section.

Authentication

While taking advantage of the ServiceStack ecosystem and decorating a handler with the AuthenticateAttribute attribute, you can only inject credentials along an HTTP request. Thinking outside the box is the key for solving this issue. We are going to use the thinking from Chapter 2, ServiceStack as Your Unique Point of Access of the section Adding authentication and authorization to the Ticket application, by creating a session in the producer and attaching the session identifier to the DTO, which will then be used in the service to map it to a header based authentication.

First, we need to introduce SessionId to our Hello DTO.

using ServiceStack;

public class Hello : IReturnVoid
                   IHasSessionId
{
  public string SessionId { get; set; }
}

Next, we will adapt our producer to create...