[英]Pyramid: why can't I use an authentication policy without an authorization policy?
[英]Pyramid: Is it possible to use Authorization without Authentication?
我的組織使用OpenAM SSO進行身份驗證,我的應用程序使用金字塔編寫。 用戶標識將在HTTP標頭中傳遞。 我也可以將它配置為傳遞組和權限,我可以在acl中使用它。 這使得金字塔中的身份驗證變得多余。 是否可以完全廢除Authenticaion政策並單獨授權?
您需要一種方法來告訴金字塔的授權系統該人是誰(他們的有效原則)。 這是身份驗證策略的責任,即使它像解析頭一樣簡單。
class CustomAuthenticationPolicy(object):
def effective_principals(self, request):
principals = [Everyone]
identity = request.headers.get('x-identity')
# validate the identity somehow
if is_valid(identity):
principals += [Authenticated, identity, 'g:editors']
return principals
config.set_authentication_policy(CustomAuthenticationPolicy())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.