Compare commits
2 commits
22efffa11b
...
74a3f9210b
Author | SHA1 | Date | |
---|---|---|---|
74a3f9210b | |||
95ed826629 |
4 changed files with 19 additions and 1 deletions
|
@ -33,7 +33,6 @@
|
||||||
<include package="zope.app.form.browser" />
|
<include package="zope.app.form.browser" />
|
||||||
<include package="zope.app.basicskin" />
|
<include package="zope.app.basicskin" />
|
||||||
<include package="zope.browsermenu" />
|
<include package="zope.browsermenu" />
|
||||||
<include package="zope.principalregistry" />
|
|
||||||
<include package="zope.authentication" />
|
<include package="zope.authentication" />
|
||||||
<include package="zope.securitypolicy" />
|
<include package="zope.securitypolicy" />
|
||||||
<include package="zope.login" />
|
<include package="zope.login" />
|
||||||
|
|
14
loops/server/auth.py
Normal file
14
loops/server/auth.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# loops.server.auth
|
||||||
|
|
||||||
|
# provide (register) authentication utility
|
||||||
|
# and other authentication and authorization stuff.
|
||||||
|
|
||||||
|
from scopes.server import auth
|
||||||
|
from zope.authentication.interfaces import IAuthentication
|
||||||
|
from zope.component import getUtility, provideUtility
|
||||||
|
|
||||||
|
def registerAuthUtility():
|
||||||
|
baseAuth = getUtility(IAuthentication)
|
||||||
|
print('*** registerAuthUtility, baseAuth:', baseAuth)
|
||||||
|
provideUtility(auth.JwtAuthentication(baseAuth))
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# module aliases - should be moved to loops.server.aliases
|
# module aliases - should be moved to loops.server.aliases
|
||||||
|
# or removed after migration with zodbupdate
|
||||||
from zope.securitypolicy import securitymap
|
from zope.securitypolicy import securitymap
|
||||||
sys.modules['zope.app.securitypolicy.securitymap'] = securitymap
|
sys.modules['zope.app.securitypolicy.securitymap'] = securitymap
|
||||||
|
|
||||||
|
from loops.server import auth
|
||||||
import waitress
|
import waitress
|
||||||
from zope.app.wsgi import config, getWSGIApplication
|
from zope.app.wsgi import config, getWSGIApplication
|
||||||
|
|
||||||
|
@ -21,6 +23,7 @@ def main():
|
||||||
zope_conf = getattr(config, 'zope_conf', 'zope.conf')
|
zope_conf = getattr(config, 'zope_conf', 'zope.conf')
|
||||||
print(f'starting loops server... - conf: {zope_conf}')
|
print(f'starting loops server... - conf: {zope_conf}')
|
||||||
app = getWSGIApplication(zope_conf)
|
app = getWSGIApplication(zope_conf)
|
||||||
|
auth.registerAuthUtility()
|
||||||
run(app, config)
|
run(app, config)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -31,6 +31,7 @@ from zope.security.management import getInteraction, newInteraction, endInteract
|
||||||
from cybertools.util.date import date2TimeStamp, strptime
|
from cybertools.util.date import date2TimeStamp, strptime
|
||||||
from cybertools.util.jeep import Jeep
|
from cybertools.util.jeep import Jeep
|
||||||
from loops.common import adapted, baseObject
|
from loops.common import adapted, baseObject
|
||||||
|
from loops.server import auth
|
||||||
from loops.util import getObjectForUid, getUidForObject, getCatalog, reindex
|
from loops.util import getObjectForUid, getUidForObject, getCatalog, reindex
|
||||||
|
|
||||||
os.environ['NLS_LANG'] = 'German_Germany.UTF8'
|
os.environ['NLS_LANG'] = 'German_Germany.UTF8'
|
||||||
|
@ -67,6 +68,7 @@ def setup(zope_conf=None, loopsRootPath=None, config=config):
|
||||||
if conn is None:
|
if conn is None:
|
||||||
print(f'opening ZODB connection...')
|
print(f'opening ZODB connection...')
|
||||||
conn = db.open()
|
conn = db.open()
|
||||||
|
auth.registerAuthUtility()
|
||||||
root = conn.root()['Application']
|
root = conn.root()['Application']
|
||||||
setSite(root)
|
setSite(root)
|
||||||
sm = component.getSiteManager(root)
|
sm = component.getSiteManager(root)
|
||||||
|
|
Loading…
Add table
Reference in a new issue