<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why does SplunkWeb controller intermittently throw exception &amp;quot;AuthenticationFailed&amp;quot;? in Security</title>
    <link>https://community.splunk.com/t5/Security/Why-does-SplunkWeb-controller-intermittently-throw-exception/m-p/155570#M4678</link>
    <description>&lt;P&gt;I have a SplunkWeb controller that intermittently throws the following exception:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AuthenticationFailed: [HTTP 401] Client is not authenticated
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Its odd because the controller works about 80% of the time.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Feb 2015 19:34:34 GMT</pubDate>
    <dc:creator>LukeMurphey</dc:creator>
    <dc:date>2015-02-19T19:34:34Z</dc:date>
    <item>
      <title>Why does SplunkWeb controller intermittently throw exception "AuthenticationFailed"?</title>
      <link>https://community.splunk.com/t5/Security/Why-does-SplunkWeb-controller-intermittently-throw-exception/m-p/155570#M4678</link>
      <description>&lt;P&gt;I have a SplunkWeb controller that intermittently throws the following exception:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;AuthenticationFailed: [HTTP 401] Client is not authenticated
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Its odd because the controller works about 80% of the time.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Feb 2015 19:34:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-does-SplunkWeb-controller-intermittently-throw-exception/m-p/155570#M4678</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2015-02-19T19:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does SplunkWeb controller intermittently throw exception "AuthenticationFailed"?</title>
      <link>https://community.splunk.com/t5/Security/Why-does-SplunkWeb-controller-intermittently-throw-exception/m-p/155571#M4679</link>
      <description>&lt;P&gt;If the controller caches the session then it is possible that it will keep the key around longer than its lifetime. This is because controllers stay running in SplunkWeb and thus a key can easily be kept around longer than its lifetime.&lt;/P&gt;

&lt;P&gt;You should always get a new key by calling cherrypy.session.get('sessionKey'). Don't store the key or keep it around.&lt;/P&gt;

&lt;P&gt;For example, I have seen this happen when someone cached the key in the constructor:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class SomeController(controllers.BaseController):

    def __init__(self):
        self.sessionKey = cherrypy.session.get('sessionKey')
        super(SomeController, self).__init__()

    @expose_page(must_login=True, methods=['POST']) 
    def update(self, **kwargs):
        doUpdate(self.sessionKey) # Using cached key. Oh no!
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead, the session should be obtained just before use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class SomeController(controllers.BaseController):

    def __init__(self):
        super(SomeController, self).__init__()

    @expose_page(must_login=True, methods=['POST']) 
    def update(self, **kwargs):
        doUpdate(cherrypy.session.get('sessionKey')) # Using a fresh key!
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Feb 2015 19:40:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-does-SplunkWeb-controller-intermittently-throw-exception/m-p/155571#M4679</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2015-02-19T19:40:30Z</dc:date>
    </item>
  </channel>
</rss>

