Book Image

SignalR: Real-time Application Development - Second Edition

By : Einar Ingerbrigsten
Book Image

SignalR: Real-time Application Development - Second Edition

By: Einar Ingerbrigsten

Overview of this book

Table of Contents (19 chapters)
SignalR – Real-time Application Development Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
11
Hosting a Server Using Self-hosted OWIN
Index

HTTP handler config


In order for the user to be authenticated, we need something we can call on the server to do the authentication. We could have gone with a hub for that purpose, or even a persistent connection. However, it would lead to some interesting configuration and having to disconnect from SignalR, when we were authenticated, and then having to reconnect. So instead, we can do something in the simplest possible way.

In order to be able to log in from our login page that we will be creating, we will be using an HTTP handler for authenticating and giving us the authentication cookie for any subsequent requests. We'll create the handler shortly. However, for now, let's just configure it to allow requests even if we're not logged in:

  1. Add the following right before the <system.webserver> tag in web.config:

    <location path="SecurityHandler.ashx">
      <system.web>
        <authorization>
          <allow users="*"/>
        </authorization>
      </system.web>
    &lt...