Logo Search packages:      
Sourcecode: zope-exuserfolder version File versions

def zope-exuserfolder-0.50.0::AuthSources::httpsAuthSource::httpsAuthSource::httpsAuthSource::authenticate (   self,
  username,
  passwd 
)

Authenticate a username/password combination
against the HTTPS service

Definition at line 154 of file httpsAuthSource.py.

00154                                             :
      """Authenticate a username/password combination
      against the HTTPS service"""


        ## Emergency override - uncomment this if you get locked out of your site
        ## return 1 
    
        # first check the authorization cache to minimize network traffic
        if self.isAuthenticCached(username, passwd):
            return 1
        elif self.isUnAuthenticCached(username, passwd):
            return 0
        
        
      auth = 0          
      # LOG(self.id, ERROR, "%s %s" % (username, passwd))

      params = urllib.urlencode({self.userNameParam: username,
                                   self.passwdParam: passwd})

        # by passing in params, this POSTs
        response = urllib.urlopen(self.serviceUrl, params)
        
      auth = self._parseResponse(response.read())
      
      # Everyone gets 'Authenticated' and the defaultRole
      # This also insures that user ends up in prop list upon first login
      if auth and not self.currentPropSource.getUserProperty(key=self.ROLES_KEY,
                                                 username=username,
                                                 default=None):
          roles = ['Authenticated', self.defaultRole]
          self.currentPropSource.setUserProperty(username=username,
                                       key=self.ROLES_KEY,
                                       value=roles)
        # store auth results in cache
        if auth:
            self.cacheAuth(username, passwd)
        else:
            self.cacheUnAuth(username, passwd)

      return auth

    # tell xuf to use our authenticate method
    remoteAuthMethod = authenticate


Generated by  Doxygen 1.6.0   Back to index