Skip to content

# Question about custom HttpFilter registration and instantiation #2498

@scanfghost

Description

@scanfghost

I have created a custom filter:
class JwtAuth : public drogon::HttpFilter<JwtAuth>

And applied it in my controller:

class AuthController : public drogon::HttpController<AuthController>
{
METHOD_LIST_BEGIN
    ADD_METHOD_TO(AuthController::login, "/api/login", drogon::Post);
    ADD_METHOD_TO(AuthController::changePassword, "/api/change-password", drogon::Post, "JwtAuth");
METHOD_LIST_END
};

Do I need to create a JwtAuth instance manually somewhere?
Do I need to list JwtAuth in the config.json file?
Or will Drogon register and manage the filter automatically?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions