Parses session token and creates the vector session token

        :param str session_token:

        :return:
            A Vector session Token 
        :rtype: VectorSessionToken
540177
def create(cls, session_token):
        

        version = None
        global_lsn = None
        local_lsn_by_region = {}

        if not session_token:
            return None

        segments = session_token.split(cls.segment_separator)
        
        if len(segments) < 2:
            return None

        try:
            version = int(segments[0])
        except ValueError as _:
            return None

        try:
            global_lsn = int(segments[1])
        except ValueError as _:
            return None

        for i in range(2, len(segments)):
            region_segment = segments[i]
            region_id_with_lsn = region_segment.split(cls.region_progress_separator)

            if len(region_id_with_lsn) != 2:
                return None

            try:
                region_id = int(region_id_with_lsn[0])
                local_lsn = int(region_id_with_lsn[1])
            except ValueError as _:
                return None
            local_lsn_by_region[region_id] = local_lsn

        return VectorSessionToken(version, global_lsn, local_lsn_by_region, session_token)
722106
def _parse_pool_query(self, query_str):
        
        sp = smart_parsing.PoolSmartParser()
        query = sp.parse(query_str)
        return query
335949
async def createcsrf(self, csrfarg = '_csrf'):
        
        await self.sessionstart()
        if not csrfarg in self.session.vars:
            self.session.vars[csrfarg] = uuid.uuid4().hex
1046814
def parse_auth_token_from_request(self, auth_header):
        
        if not auth_header:
            raise falcon.HTTPUnauthorized(
                description='Missing Authorization Header')

        parts = auth_header.split()

        if parts[0].lower() != self.auth_header_prefix.lower():
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: '
                            'Must start with {0}'.format(self.auth_header_prefix))

        elif len(parts) == 1:
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: Token Missing')
        elif len(parts) > 2:
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: Contains extra content')

        return parts[1]
364743
def _get_session(self, session):
        

        if not session:
            logger.debug('(SESSION_CREATE) User: %s' % self._user)
            s = requests.Session()
            s.auth = HTTPBasicAuth(self._user, self._password)
        else:
            logger.debug('(SESSION_CREATE) Object: %s' % session)
            s = session

        s.headers.update(
            {
                'content-type': 'application/json',
                'accept': 'application/json',
                'User-Agent': 'pysnow/%s' % pysnow.__version__
            }
        )

        return s
1133254
def set_token(self, redirecturl):
        
        log.debug('Setting the token on %s.' % self.session)
        self.session.token_from_fragment(redirecturl)
472107
def parse_sas_token(sas_token):
    
    sas_data = {}
    token = sas_token.partition(' ')[2]
    fields = token.split('&')
    for field in fields:
        key, value = field.split('=', 1)
        sas_data[key.lower()] = value
    return sas_data
511981
def read_session_token(secret_key, token):
    
    return jwt.decode(token.encode('utf-8'), secret_key,
        algorithms=[token_encryption_algorithm()]
    )
718406
def get_token(self, url):
        
        # A hack to avoid url-encoding the url, since the authorization service
        # doesn't work with correctly encoded urls

        parsed_url = urlparse.urlsplit(url)
        parsed_url = parsed_url._replace(path='/authorization/api')
        self.url = urlparse.urlunsplit(parsed_url)

        response = self.request(method='GET', url='/v1/token?url=' + url)
        return response.result.text
393650
def session(self) -> str:
        
        session_jwt = None
        self.user = self.user_model.where_username(self.username)
        if self.user is None:
            return None
        self.user.updated()  # update timestamp on user access
        if self.verify_password(self.user.password):
            session_id = Session.create_session_id()
            data = {
                'session_id': session_id,
                'user_id': self.user.id,
                'user_email': self.user.email,
            }
            token_valid_for = \
                current_app.config['AUTH']['JWT']['TOKENS']['VALID_FOR'] if \
                'VALID_FOR' in \
                current_app.config['AUTH']['JWT']['TOKENS'] else 180
            if current_app.config['AUTH']['JWT']['REFRESH_TOKENS']['ENABLED']:
                refresh_token_valid_for = \
                    current_app \
                    .config['AUTH']['JWT']['REFRESH_TOKENS']['VALID_FOR'] if \
                    'VALID_FOR' in \
                    current_app.config['AUTH']['JWT']['REFRESH_TOKENS'] else \
                    86400
                session_jwt = JWT().create_token_with_refresh_token(
                    data,
                    token_valid_for,
                    refresh_token_valid_for)
            else:
                session_jwt = JWT().create_token(data, token_valid_for)
            Session.create_session(session_id, self.user.id)
            return session_jwt
        return None
960545
def get_session(self, token_path=None):
        
        # TODO: remove token_path in future versions
        if token_path is not None:
            warnings.warn('"token_path" param will be removed in future versions.'
                          ' Use a TokenBackend instead.', DeprecationWarning)

        # gets a fresh token from the store
        token = self.token_backend.get_token()

        if token:
            client_id, _ = self.auth
            session = OAuth2Session(client_id=client_id, token=token)
        else:
            raise RuntimeError(
                'No auth token found. Authentication Flow needed')

        session.proxies = self.proxy

        if self.request_retries:
            retry = Retry(total=self.request_retries, read=self.request_retries,
                          connect=self.request_retries,
                          backoff_factor=RETRIES_BACKOFF_FACTOR,
                          status_forcelist=RETRIES_STATUS_LIST)
            adapter = HTTPAdapter(max_retries=retry)
            session.mount('http://', adapter)
            session.mount('https://', adapter)

        return session
248691
def generate_session_token(secret_key, **payload):
    
    return jwt.encode(payload, secret_key, algorithm=token_encryption_algorithm()).decode('utf-8')
612841
def request_session(token, url=None):
	
	if url is None:
		api = SlackApi()
	else:
		api = SlackApi(url)

	response = api.rtm.start(token=token)
	return SessionMetadata(response, api, token)
998442
def csrf_token():
    
    if "_csrf_token" not in session:
        session["_csrf_token"] = os.urandom(128)
    return hmac.new(app.secret_key, session["_csrf_token"],
            digestmod=sha1).hexdigest()
29242
def fetch_token(self, **kwargs):
        
        if 'client_secret' not in kwargs:
            kwargs.update(client_secret=self.client_secret)
        return self.session.fetch_token(token_url, **kwargs)
970508
function makeSession(session) {
  return {
    authenticated: !!session.token,
    token: session.token,
    scope: session.scope,
    error: session.error,
    errorDescription: session.errorDescription
  };
}
98134
def csrf_token():
    
    from uliweb import request, settings
    from uliweb.utils.common import safe_str
    
    v = {}
    token_name = settings.CSRF.cookie_token_name
    if not request.session.deleted and request.session.get(token_name):
        v = request.session[token_name]
        if time.time() >= v['created_time'] + v['expiry_time']:
            v = {}
        else:
            v['created_time'] = time.time()
    if not v:
        token = request.cookies.get(token_name)
        if not token:
            token = uuid.uuid4().get_hex()
        
        v = {'token':token, 'expiry_time':settings.CSRF.timeout, 'created_time':time.time()}

    if not request.session.deleted:
        request.session[token_name] = v
    return safe_str(v['token'])