Get the AUTH message (as specified in the RFC)
503601
private String getAuthMessage() {
        if (clientFirstMessageBare == null) {
            throw new RuntimeException("can't call getAuthMessage without clientFirstMessageBare is set");
        }
        if (serverFirstMessage == null) {
            throw new RuntimeException("can't call getAuthMessage without serverFirstMessage is set");
        }
        if (clientFinalMessageNoProof == null) {
            throw new RuntimeException("can't call getAuthMessage without clientFinalMessageNoProof is set");
        }
        return clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageNoProof;
    }
900952
def authenticationReject():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x11)  # 00010001
    packet = a / b
    return packet
493994
def _parse_auth_message(self, auth_message):
        
        result = {}

        has_matched = False

        for regex in REGEXES_INVALID_USER:
            # Check for the invalid user/ip messages
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

                # Save the username and IP
                result['username'] = m.group('user')
                result['ip'] = m.group('ip')

        for regex in REGEXES_INVALID_IP:
            # Check for the invalid ip messages
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

                # Save the IP
                result['ip'] = m.group('ip')                        

        for regex in REGEXES_IGNORE:
            # Check for messages we want to ignore
            m = re.search(regex, auth_message)

            if m and not has_matched:
                has_matched = True

        # If it's an ssh log and we don't know what it is, handle that
        if not has_matched:
            sys.stderr.write("Unhandled auth message: %s\n" % auth_message)

        return result
600254
def auth_tls(self, mount_point='cert', use_token=True):
        
        return self.login('/v1/auth/{0}/login'.format(mount_point), use_token=use_token)
213121
def parse_auth(header):
    
    try:
        method, data = header.split(None, 1)
        if method.lower() == 'basic':
            data = base64.b64decode(uniorbytes(data, bytes))
            user, pwd = uniorbytes(data).split(':', 1)
            return user, pwd
    except (KeyError, AttributeError, ValueError):
        return (None, None)
182437
def get_authorization_url(self):
        """"""
        url = self._get_oauth_url('authenticate')
        query = {
            'client_id': self._client_id,
            'response_type': 'code',
            'redirect_uri': self.callback
        }
        query_str = self.urlencode(query)

        return url + '?' + query_str
498549
private String getOAuthAuthString(HttpRequest req)
            throws OAuthException, IOException, URISyntaxException {
        RealmOAuthConsumer consumer = getConsumer();
        OAuthAccessor accessor = new OAuthAccessor(consumer);

        String method = req.getMethod().name();
        URI uri = req.getURI();

        OAuthMessage msg = accessor.newRequestMessage(method, uri.toString(), null);
        return msg.getAuthorizationHeader(consumer.getRealm());
    }
1107536
def http_auth_required(realm):
    """"""

    def decorator(fn):
        @wraps(fn)
        def wrapper(*args, **kwargs):
            if _check_http_auth():
                return fn(*args, **kwargs)
            if _security._unauthorized_callback:
                return _security._unauthorized_callback()
            else:
                r = _security.default_http_auth_realm \
                    if callable(realm) else realm
                h = {'WWW-Authenticate': 'Basic realm="%s"' % r}
                return _get_unauthorized_response(headers=h)
        return wrapper

    if callable(realm):
        return decorator(realm)
    return decorator
976269
def get_auth_header(self, user_payload):
        
        auth_token = self.get_auth_token(user_payload)
        return '{auth_header_prefix} {auth_token}'.format(
            auth_header_prefix=self.auth_header_prefix, auth_token=auth_token
        )
476815
def authenticationRequest():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x12)  # 00010010
    c = CiphKeySeqNrAndSpareHalfOctets()
    d = AuthenticationParameterRAND()
    packet = a / b / c / d
    return packet
1186937
def _get_auth_packet(self, username, password, client):
        
        pkt = client.CreateAuthPacket(code=AccessRequest,
                                      User_Name=username)
        pkt["User-Password"] = pkt.PwCrypt(password)
        pkt["NAS-Identifier"] = 'django-radius'
        for key, val in list(getattr(settings, 'RADIUS_ATTRIBUTES', {}).items()):
            pkt[key] = val
        return pkt
63949
def get_auth(self):
        '''  '''
        return (self._cfgparse.get(self._section, 'username'), self._cfgparse.get(self._section, 'password'))
4391
def authentication(self):
        """"""
        if self.session.digest:
            authentication = self.session.generate_digest()
        elif self.session.basic:
            authentication = self.session.generate_basic()
        else:
            return ''
        return "Authorization: " + authentication + '\r\n'
388282
def auth(self):
        """"""
        response = requests.post(
            parse.urljoin(self.base_url, '/api/auth'),
            timeout=self.timeout,
            data={'username': self.username, 'password': self.password})
        response.raise_for_status()
        json = response.json()
        if 'jwt' not in json:
            raise ValueError("Not authorized: didn't receive token, check username or password.")
        self.jwt = json['jwt']
        return json
219571
def extract_client_auth(request):
    
    auth_header = request.META.get('HTTP_AUTHORIZATION', '')

    if re.compile('^Basic\s{1}.+$').match(auth_header):
        b64_user_pass = auth_header.split()[1]
        try:
            user_pass = b64decode(b64_user_pass).decode('utf-8').split(':')
            client_id, client_secret = tuple(user_pass)
        except Exception:
            client_id = client_secret = ''
    else:
        client_id = request.POST.get('client_id', '')
        client_secret = request.POST.get('client_secret', '')

    return (client_id, client_secret)
1172939
def to_string(self):
        
        items = [
            ('oauth_token', self.key),
            ('oauth_token_secret', self.secret),
        ]

        if self.callback_confirmed is not None:
            items.append(('oauth_callback_confirmed', self.callback_confirmed))
        return urlencode(items)
910122
def whoami(ctx, opts):
    """"""
    click.echo("Retrieving your authentication status from the API ... ", nl=False)

    context_msg = "Failed to retrieve your authentication status!"
    with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
        with maybe_spinner(opts):
            is_auth, username, email, name = get_user_brief()

    click.secho("OK", fg="green")
    click.echo("You are authenticated as:")
    if not is_auth:
        click.secho("Nobody (i.e. anonymous user)", fg="yellow")
    else:
        click.secho(
            "%(name)s (slug: %(username)s, email: %(email)s)"
            % {
                "name": click.style(name, fg="cyan"),
                "username": click.style(username, fg="magenta"),
                "email": click.style(email, fg="green"),
            }
        )