It works the same way, but on TG2.4 config variables are no longer mixed
between dictionaries and flat variables.
All config options are now flat.

That means that instead of setting config["sa_auth"]["cookie_secret"] in
some cases and config["sa_auth.cookie_secret"] in some other cases you now
always do set only config["sa_auth.cookie_secret"]
See
https://github.com/TurboGears/tg2/blob/e9149c01620304664d3a3402f72de89ba4261dbd/tests/test_configuration.py#L348-L349

This is probably the configuration you are looking for

from repoze.who.plugins.basicauth import BasicAuthPlugin
from repoze.who.plugins.htpasswd import HTPasswdPlugin, plain_check

base_auth = BasicAuthPlugin('MyTGApp')

# Configure the authentication backend
base_config.update_blueprint({
'auth_backend': 'authmetadata',

# YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP
'sa_auth.cookie_secret': "6ead0776-5ace-43d3-bbe6-e4eee8bc20b9",
'sa_auth.authmetadata': ApplicationAuthMetadata(model.DBSession,
model.User),

'sa_auth.identifiers': [('basicauth', base_auth)],
'sa_auth.form_identifies': False,
'sa_auth.challengers': [('basicauth', base_auth)],
'sa_auth.authenticators': [('htpasswd', HTPasswdPlugin('./htpasswd',
plain_check))],

...

On Tue, Mar 31, 2020 at 3:59 AM Jorge Macias <[email protected]>
wrote:

> Hi
>
> I followed this guide
> <https://turbogears.readthedocs.io/en/latest/turbogears/authentication.html?highlight=authenticate#authenticating-user>
> but i have the following error:
>
> FullStackApplicationConfigurator object has no attribute 'sa_auth'
>
>
> Does anybody know if basic auth is available with TG 2.4?
>
>
> I have no problems with turbogears 2.3
>
>
> Does any body knows how to configure in 2.4?
>
>
> I'll appreciate any help
>
>
> Thanks in advance.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/turbogears/b7a066c1-8795-4cae-b8dd-14dd879e0a69%40googlegroups.com
> <https://groups.google.com/d/msgid/turbogears/b7a066c1-8795-4cae-b8dd-14dd879e0a69%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/turbogears/CAJfq2JFFj9ZZE4hYWX9zDmdtyssPd%2BtYULtXDhr41aLOgN0COw%40mail.gmail.com.

Reply via email to