Is it possible to user custom authentication in keystone.js without a keystone user model?
<p>I have a (I hope) quick question regarding Authorization in Keystone: it seems like the "User" object is a core dependency in the framework. I'd like to side-step it completely but there doesn't seem to be a way to get the application functional without it.</p>

<p>I've run a basic bypass here:</p>

<pre><code>keystone.init({
    //...
    'auth': (req, res, next)=&gt;{
      if(Roles.has(Roles.Admin, Roles.Keyston)){
        next();
      } else {
        throw "403"; //Terminate
      }
    },
    'user model': 'User',
    //...
})
</code></pre>

<p>Which results in:</p>

<pre><code>Sorry, an error occurred loading the page (500)

snip\KS2\node_modules\keystone\templates\layout\base.jade:80
&gt; 79| a(href='/keystone/' + User.path + '/' + user.id)= User.getDocumentName(user)
80| | .
81| 
82| //- Common

item.get is not a function
</code></pre>

<p>As a result it expects the user object to exist on the request (even though I'm using my own authentication method). If I disable authentication completely it seems fine and I can protect the route with some middleware, but this seems like fairly buggy behavior. </p>

<p>Is the "User" object actually a dependency in the framework or is it basically there for convinience? Removing the model </p>

<pre><code>//'user model' : 'User'
</code></pre>

<p>crashes Keystone </p>

<pre><code>Sorry, an error occurred loading the page (500) Unknown keystone list undefined).
</code></pre>

<p>I'm fairly certain the former error is related to the "User Object" on the request being set to something silly and thus the Jade template blows up. Is it possible to decouple this User object from the framework? If it isn't is it possible to set this object so that I can continue using <code>passport.js</code> for primary authentication?</p>

<p>I'm particularly interested in this topic as I'd like to implement Role Based Authentication in the Keystone.js administration module and without more information on how this works/ideas for workarounds I don't have a jumping off point.</p>

<p>(**EDIT The error exists even with auth set to false)</p>

<pre><code>Sorry, an error occurred loading the page (500)

...snip\KS2\node_modules\keystone\templates\layout\base.jade:78
76| if User &amp;&amp; user
77| | Signed in as 
&gt; 78| a(href='/keystone/' + User.path + '/' + user.id)= User.getDocumentName(user)
79| | .
80| 
81| //- Common

item.get is not a function
</code></pre>

<p>Exits even with <code>auth: false</code> as I have a "user" object that is turning up null and crashing the template.</p>

<p><strong>EDIT #2</strong>
I've created a patch that solved the crash when user authentication is turned off, it doesn't really answer the question but it makes the application usable once again without depending on Keystone.js for authentication (which was a CRITICAL requirement for this CMS).</p>