我無法讓金字塔的基本認證機制爲我工作。我做錯了嗎?金字塔認證問題(記住+ authenticated_userid)
要調試,我跑的代碼塊中的我的觀點之一:
print '$$$1', pyramid.security.remember(request, 12)
print '$$$2', pyramid.security.unauthenticated_userid(request)
print '$$$3', pyramid.security.authenticated_userid(request)
這是我得到的輸出:
$$$ 1( '設置Cookie', 'auth_tkt =「45a66a6e860356b991cc8fc8acf9bf7f4d8b3d2212!userid_type:int」; Path = /'),('Set-Cookie','auth_tkt ='45a66a6e860356b991cc8fc8acf9bf7f4d8b3d2212!userid_type:int「; Path = /; Domain = 127.0.0.1:6543'), 'Set-Cookie','auth_tkt ='45a66a6e860356b991cc8fc8acf9bf7f4d8b3d2212!userid_type:int「; Path = /; Domain = .127.0.0.1:6543')]
$$$ 2無
$$$ 3無
我有工作的request.session我,所以我猜這個問題是不是與餅乾。
下面是我在__init__
使用配置金字塔代碼:
authn_policy = AuthTktAuthenticationPolicy('secret', callback=lambda x:[])
engine = engine_from_config(settings, 'sqlalchemy.')
initialize_sql(engine)
my_session_factory = UnencryptedCookieSessionFactoryConfig('anothersecret')
config = Configurator(settings=settings, session_factory=my_session_factory,
authentication_policy=authn_policy,
)
請幫幫忙!
請更新鏈接!這似乎是不正確的,也許是因爲官方網站重新設計? – Augiwan 2013-01-16 07:51:24
更新了鏈接 – Efren 2018-01-22 00:00:15