Skip to content

Use authenticate_header method to get header prefix #276

@Rasmnev

Description

@Rasmnev

If authenticate_header method is used in line 38 it would be easier to use multiple prefixes by just subclassing TokenAuthentication and overriding that method

for example:

class BearerAuth(TokenAuthentication):
    def authenticate_header(self, request):
        return "Bearer"

REST_FRAMEWORK = {
  ...
  "DEFAULT_AUTHENTICATION_CLASSES": (
      "knox.auth.TokenAuthentication",
      "BearerAuth",
  ),
  ...
}

REST_KNOX = {
...
"AUTH_HEADER_PREFIX": "Token",
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions