Пример #1
0
    def __init__(self,
            manager=DefaultManager,
            realm='',
            request_token_path='/oauth/request_token',
            access_token_path='/oauth/access_token',
            **kwargs
        ):

        self.realm = realm
        # The oauth2 server implementation to handle signatures
        self.server = oauth2.Server(signature_methods={
            # Supported signature methods
            'HMAC-SHA1': oauth2.SignatureMethod_HMAC_SHA1(),
            'RSA-SHA1': SignatureMethod_RSA_SHA1(),
        })

        # Remember the paths to serve the tokens on
        self.paths = dict(
            request=request_token_path,
            access=access_token_path)

        # Allow manager to be provided as an entry point from config
        if isinstance(manager, (str, unicode)):
            manager = _resolve(manager)
        self.manager = manager(**kwargs)
def make_plugin(login_form_qs,
                rememberer_name,
                formcallable,
               ):
    if rememberer_name is None:
        raise ValueError(
            'must include rememberer key (name of another IIdentifier plugin)')
    if isinstance(formcallable, str):
        formcallable = _resolve(formcallable)
    plugin = FormPlugin(login_form_qs, rememberer_name, formcallable)
    return plugin
Пример #3
0
def make_plugin(login_form_qs='__do_login',
                rememberer_name=None,
                form=None,
                formcallable=None,
               ):
    if rememberer_name is None:
        raise ValueError(
            'must include rememberer key (name of another IIdentifier plugin)')
    if form is not None:
        form = open(form).read()
    if isinstance(formcallable, str):
        formcallable = _resolve(formcallable)
    plugin = FormPlugin(login_form_qs, rememberer_name, form, formcallable)
    return plugin
Пример #4
0
    def __init__(self,
                 manager=DefaultManager,
                 realm='',
                 request_token_path='/oauth/request_token',
                 access_token_path='/oauth/access_token',
                 **kwargs):

        self.realm = realm
        # The oauth2 server implementation to handle signatures
        self.server = oauth2.Server(
            signature_methods={
                # Supported signature methods
                'HMAC-SHA1': oauth2.SignatureMethod_HMAC_SHA1(),
                'RSA-SHA1': SignatureMethod_RSA_SHA1(),
            })

        # Remember the paths to serve the tokens on
        self.paths = dict(request=request_token_path, access=access_token_path)

        # Allow manager to be provided as an entry point from config
        if isinstance(manager, (str, unicode)):
            manager = _resolve(manager)
        self.manager = manager(**kwargs)