Laravel 5.2 authentication with custom routes
<p>I'm working in a web project using Laravel 5.2</p>

<p>My use case is very simple:
Before rendering any page, verify if the user is authenticated. If not, provide a login form with custom authentication (not the Eloquent's default stuff)</p>

<p>After reading about this scenario I have:</p>

<pre><code>// routes.php
Route::get('/', 'HomeController@index');
</code></pre>

<p>Then if I want all my pages secured, I require the middleware <strong>auth</strong> in controller's constructor. All my controllers should follow the same pattern if I want to request a logged in user before serving any page.</p>

<pre><code>// app/Http/Controllers/HomeController.php
&lt;?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;

class HomeController extends Controller
{
  public function __construct()
  {
      $this-&gt;middleware('auth');
  }

  public function index()
  {
      return view('home');
  }
}
</code></pre>

<p>So far, so good. If I visit my app at '/' I'm redirected to a /login page.</p>

<p>I created the login page:</p>

<pre><code>// views/auth/login.blade.php
@extends('layouts.app')

@section('content')
    &lt;form class="form-signin" method="post" action="{{ url ('/login') }}"&gt;
        {!! csrf_field() !!}
        &lt;h2 class="form-signin-heading"&gt;Please sign in&lt;/h2&gt;
        &lt;label for="inputUsername" class="sr-only"&gt;Username&lt;/label&gt;
        &lt;input type="text" id="inputUsername" class="form-control" placeholder="Username" name="username" required autofocus&gt;
        &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt;
        &lt;input type="password" id="inputPassword" class="form-control" placeholder="Password" name="password" required&gt;        
        &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
    &lt;/form&gt;

@endsection
</code></pre>

<p>Please notice the action of the form that redirects to /login. 
Then I update the routes.php by providing the new following routes:</p>

<pre><code>// Authentication Routes...
Route::get('login', 'Auth\AuthController@showLoginForm');
Route::post('login', 'Auth\AuthController@login');
Route::get('logout', 'Auth\AuthController@logout');

Route::get('/', 'HomeController@index');
</code></pre>

<p>With these new routes I'm catching login/logout scenarios and assigning AuthController's methods to handle them.</p>

<p>On the already implemented AuthController, I guess I need to define these methods. </p>

<p>I was not able to make this to work or maybe I'm doing this custom authentication in a wrong way.</p>

<p>I have:</p>

<pre><code>// app/Http/Auth/AuthController.php
&lt;?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
    use AuthenticatesAndRegistersUsers, ThrottlesLogins;
    protected $redirectTo = '/';

    public function __construct()
    {
        $this-&gt;middleware($this-&gt;guestMiddleware(), ['except' =&gt; 'logout']);
    }

    // ... lot of default stuff ..

    protected function login($data)
    {
        //
        // do custom login authentication with $data
        // ie: validate thru a web service or something
        //

        return redirect()-&gt;intended('/');
    }
}
</code></pre>

<p>Any suggestions on how to implement this?</p>