Return the auth object
174462
def _auth():
    '''
    
    '''
    if 'auth' not in __context__:
        try:
            __context__['auth'] = salt.crypt.SAuth(__opts__)
        except SaltClientError:
            log.error('Could not authenticate with master.'
                      'Mine data will not be transmitted.')
    return __context__['auth']
227670
def auth(self, auth_key):
        
        if self._socket is None:
            self._socket = self._connect()
        return self.call('auth', {"AuthKey": auth_key}, expect_body=False)
1352581
def basic_auth(self, username, password):
        
        if not (username and password):
            return

        self.auth = (username, password)

        # Disable token authentication
        self.headers.pop('Authorization', None)
559315
def parse_auth(header):
    
    try:
        method, data = header.split(None, 1)
        if method.lower() == 'basic':
            user, pwd = touni(base64.b64decode(tob(data))).split(':',1)
            return user, pwd
    except (KeyError, ValueError):
        return None
789467
function(auth){
      // nothing to invert
      if(!auth || !auth.user){
        return auth;
      }

      var u = auth.user;
      delete(auth.user);
      u.auth = auth;
      return u;
    }
873498
def get_request(self, request):
        """"""
        request.headers['authenticate'] = {
            'username': self.username,
            'apiKey': self.api_key,
        }
        return request
279561
def get_authorization(self, **kwargs):
        """"""
        if self.authorization is not None:
            return self.authorization

        auth_class = self.get_authorization_class()
        auth_user = self.get_authorization_user()
        auth_kwargs = {
            'token': self.get_authorization_token(**kwargs)
        }

        if auth_user and auth_user.is_authenticated():
            auth_kwargs['created_user'] = self.get_authorization_user()

        self.authorization = auth_class.objects.get_by_token_or_404(
            **auth_kwargs
        )
        return self.authorization
1150093
def get_auth_user():
    
    from uliweb import request
    from uliweb import settings

    user_fieldname = settings.get_var('AUTH/GET_AUTH_USER_FIELDNAME', 'id')

    session_key = _get_auth_key()
    user_id = request.session.get(session_key)
    if user_id:
        if isinstance(user_id, dict):
            return user_id
        else:
            User = get_model('user')
            user = User.get(User.c[user_fieldname]==user_id)
            return user
13468
def get_client(self, email=None, password=None, **__):
        """"""
        if self.client is not None:
            return self.client
        return Auth(email, password)
643642
def auth(self):
        
        if self._auth is None:
            self._auth = AuthTypesList(
                self._version,
                account_sid=self._solution['account_sid'],
                domain_sid=self._solution['sid'],
            )
        return self._auth
493675
def authentify(self, func):
        ''''''
        @wraps(func)
        def wrapper(*args, **kwargs):
            if current_user.is_authenticated:
                return func(*args, **kwargs)

            apikey = request.headers.get(HEADER_API_KEY)
            if apikey:
                try:
                    user = User.objects.get(apikey=apikey)
                except User.DoesNotExist:
                    self.abort(401, 'Invalid API Key')

                if not login_user(user, False):
                    self.abort(401, 'Inactive user')
            else:
                oauth2.check_credentials()
            return func(*args, **kwargs)
        return wrapper
813277
def auth(self):
        
        username = self._settings["username"]

        if not username:
            raise ValueError("Username was not configured in %s" % CONFIG_FILE)

        if self._settings["use_keyring"]:
            password = self.keyring_get_password(username)
            if not password:
                self.keyring_set_password(username)
                password = self.keyring_get_password(username)
        else:
            password = self._settings["password"]

        return self._settings["username"], password
1076931
def _auth(self):
        
        ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M:%S")
        hash_string = hashlib.md5("%s%s%s" % (ts, self.private_key, self.public_key)).hexdigest()
        return "ts=%s&apikey=%s&hash=%s" % (ts, self.public_key, hash_string)
523561
def check_auth(self):
        """"""
        # access permissions
        if self.auth is not None:
            return self.auth(self.request)

        return self.public_readble, self.public_writable
1003106
def authcode_get(self, path, **kwargs):
        
        kwargs.setdefault('params', {})['authcode'] = self.authcode
        return self._session.okc_get(path, **kwargs)
1217129
def api_auth(func):
    
    @wraps(func)
    def _decorator(request, *args, **kwargs):
        authentication = APIAuthentication(request)
        if authentication.authenticate():
            return func(request, *args, **kwargs)
        raise Http404
    return _decorator
1218542
def authenticated(viewfunc):
    """"""
    @wraps(viewfunc)
    def wrapper(*args, **kwargs):
        ctx = stack.top
        if ctx and hasattr(ctx, 'htauth'):
            auth_header = request.headers.get('Authorization', None)
            if not auth_header:
                return _unauthorized_response()

            if not auth_header.startswith('Basic '):
                raise RuntimeError('Flask-HTAuth supports only Basic auth.')

            auth_header = auth_header.replace('Basic ', '')
            auth_header = base64.b64decode(auth_header)
            username, password = auth_header.split(':', 1)

            if not username in ctx.htauth['users']:
                return _unauthorized_response()

            if not check_password(password, ctx.htauth['users'][username]):
                return _unauthorized_response()

            g.htauth_user = username

        return viewfunc(*args, **kwargs)

    return wrapper