Made authorization optional

Change-Id: Ib86f47d05136bc806a3f4ccde5e567a387528804
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 799d8d3..b324be5 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -74,7 +74,9 @@
     my $mount_point = '/api/v0.1/';
 
     $self->plugin(Mount => {
-      $mount_point => $self->home->child('lib/Kalamar/Apps/test_backend.pl')
+      $mount_point => $self->home->child(
+        'lib/Kalamar/Apps/test_backend.pl'
+      )
     });
 
     # Fix api endpoints
@@ -128,18 +130,28 @@
   $self->log->info('API expected at ' . $self->config->{Kalamar}->{api});
 
   # Establish routes with authentification
-  my $r = $self->routes->under(
-    '/' => sub {
-      my $c = shift;
+  my $r = $self->routes;
 
-      if ($c->session('auth')) {
-        $c->stash(auth => $c->session('auth'));
-        $c->stash(user => $c->session('user'));
-      };
-      return 1;
-    }
+  # Check for auth support
+  $self->defaults(
+    auth_support => $self->config('Kalamar')->{auth_support}
   );
 
+  # Support auth
+  if ($self->stash('auth_support')) {
+    $r = $r->under(
+      '/' => sub {
+        my $c = shift;
+
+        if ($c->session('auth')) {
+          $c->stash(auth => $c->session('auth'));
+          $c->stash(user => $c->session('user'));
+        };
+        return 1;
+      }
+    );
+  };
+
   # Base query route
   $r->get('/')->to('search#query')->name('index');