Only accept one form of authentication.
186990
def authentication_validation(username, password, access_token):
    '''
    
    '''
    if bool(username) is not bool(password):
        raise Exception("Basic authentication requires a username AND"
                        " password.")
    if (username and access_token) or (password and access_token):
        raise Exception("Cannot use both Basic Authentication and"
                        " OAuth2.0. Please use only one authentication"
                        " method.")
876878
def accept_all(self):
        '''
        
        '''
        keys = self.list_keys()
        for key in keys[self.PEND]:
            try:
                shutil.move(
                        os.path.join(
                            self.opts['pki_dir'],
                            self.PEND,
                            key),
                        os.path.join(
                            self.opts['pki_dir'],
                            self.ACC,
                            key)
                        )
                eload = {'result': True,
                         'act': 'accept',
                         'id': key}
                self.event.fire_event(eload,
                                      salt.utils.event.tagify(prefix='key'))
            except (IOError, OSError):
                pass
        return self.list_keys()
1327521
def login_generic(request, username, password):
        """"""
        user = authenticate(username=username, password=password)
        if user is not None and user.is_active:
            login(request, user)
            return True
        return False
627012
def basic_auth(opts)
      user = opts.fetch :user
      pass = opts.fetch :pass

      auth("Basic " + Base64.strict_encode64("#{user}:#{pass}"))
    end
124094
def accept(self):
        """"""
        newsock, addr = socket.accept(self)
        ssl_sock = SSLSocket(newsock._sock,
                             keyfile=self.keyfile,
                             certfile=self.certfile,
                             server_side=True,
                             cert_reqs=self.cert_reqs,
                             ssl_version=self.ssl_version,
                             ca_certs=self.ca_certs,
                             do_handshake_on_connect=self.do_handshake_on_connect,
                             suppress_ragged_eofs=self.suppress_ragged_eofs,
                             ciphers=self.ciphers)
        return ssl_sock, addr
818834
def authenticate(self, request, **credentials):
        """"""
        from allauth.account.auth_backends import AuthenticationBackend

        self.pre_authenticate(request, **credentials)
        AuthenticationBackend.unstash_authenticated_user()
        user = authenticate(request, **credentials)
        alt_user = AuthenticationBackend.unstash_authenticated_user()
        user = user or alt_user
        if user and app_settings.LOGIN_ATTEMPTS_LIMIT:
            cache_key = self._get_login_attempts_cache_key(
                request, **credentials)
            cache.delete(cache_key)
        else:
            self.authentication_failed(request, **credentials)
        return user
545326
public function disable()
    {
        if ($this->getAuthenticationTypeID() == 1) {
            throw new Exception(t('The core concrete5 authentication cannot be disabled.'));
        }
        $db = Loader::db();
        $db->Execute(
           'UPDATE AuthenticationTypes SET authTypeIsEnabled=0 WHERE AuthTypeID=?',
           [$this->getAuthenticationTypeID()]);
    }
170066
def _get_authentication_from_public_key_id(self, key_id):
        """"""
        for authentication in self._authentications:
            if authentication.is_key_id(key_id):
                return authentication
        return None
585341
def set_basic(self, realm='authentication required'):
        """"""
        dict.clear(self)
        dict.update(self, {'__auth_type__': 'basic', 'realm': realm})
        if self.on_update:
            self.on_update(self)
408748
public static Authentication plain(String username, String password) {
        return new AuthenticationImpl(username, password, AuthMode.Plain);
    }
431005
def auth_pair(self, force_console=False):
        """"""
        if not self.auth_valid():
            self._get_auth(force_console)
        return (self.user, self.password)
993959
def auth(self, value):
        
        self._auth = value
        self._request.auth = value
106816
function() {
            auth.type = 'basic';

            auth.username = process.env.GHusername || octofish.config.auth.username || null;
            auth.password = process.env.GHpassword || octofish.config.auth.password || null;

            if ( !auth.password || !auth.username ) {
                return false;
            } else {
                octofish.github.authenticate( auth );
                return true;
            }
        }
480882
def authentications_spec(self):
        """"""
        return container_spec(authentication_objs.Authentication
              , dictof(string_spec(), set_options(
                  reading = optional_spec(authentication_spec())
                , writing = optional_spec(authentication_spec())
                )
              )
            )
890421
def authenticate(identity=None, provider=None):
        "  "
        if not identity:
            return None

        try:
            netid = NetID.objects.get(identity=identity, provider=provider)
            return netid.user
        except NetID.DoesNotExist:
            return None
1090035
function(user, passwd){
                //setter only

                validators.string(user);
                validators.string(passwd);
                data.auth = {
                    user : user,
                    passwd : passwd
                };

                return this;
            }
740163
def requires_password_auth(fn):
    """"""
    def wrapper(self, *args, **kwargs):
        self.auth_context = HAPI.auth_context_password
        return fn(self, *args, **kwargs)
    return wrapper