[Update] 添加 authentication backend header

pull/3948/head
ibuler 2020-04-22 15:13:04 +08:00
parent 0d2b4d7ca3
commit 5f2c9c3801
1 changed files with 6 additions and 0 deletions

View File

@ -106,6 +106,9 @@ class AccessKeyAuthentication(authentication.BaseAuthentication):
raise exceptions.AuthenticationFailed(_('User disabled.'))
return access_key.user, None
def authenticate_header(self, request):
return 'Sign access_key_id:Signature'
class AccessTokenAuthentication(authentication.BaseAuthentication):
keyword = 'Bearer'
@ -143,6 +146,9 @@ class AccessTokenAuthentication(authentication.BaseAuthentication):
raise exceptions.AuthenticationFailed(msg)
return user, None
def authenticate_header(self, request):
return self.keyword
class PrivateTokenAuthentication(authentication.TokenAuthentication):
model = PrivateToken