Kotti As A Library

30 views
Skip to first unread message

Ezra

unread,
Apr 1, 2019, 2:03:20 AM4/1/19
to Kotti
Hi

May Kotti's Authentication and Authorization be used to protect other Pyramid applications
without rolling out new authn_policy_factory or principals_factory  ?

Here is myapp/__init__.py:
default_settings = {
    'pyramid.includes': 'myapp myapp.views',
    'kotti.base_includes': (
        'kotti kotti.views kotti.views.login kotti.views.users'),
    'kotti.use_tables': 'principals',
    'kotti.site_title': 'Kotti As A Library',
    }

def main(global_config, **settings):
    settings2 = default_settings.copy()
    settings2.update(settings)
    config = kotti.base_configure(global_config, **settings2)
    engine = sqlalchemy.engine_from_config(config.registry.settings, 'sqlalchemy.')
    kotti.resources.initialize_sql(engine)
    return config.make_wsgi_app()


And here is development.ini:
[app:myapp]
use = egg:myapp

pyramid.reload_templates = true
pyramid.debug_authorization = true
# pyramid.debug_notfound = true
pyramid.debug_routematch = true
pyramid.default_locale_name = en
pyramid.includes =
                    pyramid_tm
                    pyramid_jinja2
                    pyramid_debugtoolbar


# Kotti As A Library Config:
# pyramid.includes = pyramid_tm
mail.default_sender = yourname@yourhost
sqlalchemy.url = sqlite:///%(here)s/kotti_lib_db.db
kotti.secret = secret

[filter:fanstatic]
use = egg:fanstatic#fanstatic

[pipeline:main]
pipeline =
    fanstatic
    myapp
# Kotti As A Library Ends Here.


browsing to http://X.X.X.X/login, able to login and authenticate
however after login, being forwarded to root of the application and getting below error:

404 Not Found

The resource could not be found.
/


And with debug enabled, below error:
debug_notfound of url http://X.X.X.X:6543/; path_info: '/', context: <Document 1 at />,
view_name: '', subpath: (), traversed: (), root: <Document 1 at />, vroot: <Document 1 at />,
vroot_path: ()


Do I need to include context or permission in myapp/views to be able to use default Kotti authentication policy ?

If I am to roll out new principal or root factory, what is the minimum default_settings directives in below document:
https://kotti.readthedocs.io/en/latest/developing/advanced/as-a-library.html
Do I need to roll out all those directives mentioned in default_settings.



Thanks
Ezra
Reply all
Reply to author
Forward
0 new messages