Skip to content

Token prefix not being stripped #688

Closed
@utdrmac

Description

@utdrmac

In src/Application.php

        $service->loadAuthenticator('Authentication.Token', [
            'header' => 'X-Dipper-Auth',
            'tokenPrefix' => 'dipper_',
        ]);

Testing like this:

$ curl --verbose -H 'X-Dipper-Auth: dipper_sdfasdfadsf' https://domain.com/

dipper_ is the token prefix. It is not being stripped before being passed to my identifier. Looking at the code in vendor/cakephp/authentication/src/Authenticator/TokenAuthenticator.php, I found the function stripTokenPrefix() which does something odd:

     	return str_ireplace($prefix . ' ', '', $token);

Why is the replace concatenated with an empty space? That's not part of my prefix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions