drogonframework / drogonframework/drogon

# Question about custom HttpFilter registration and instantiation

Open
#2,498 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 12h
Merged PRs (30d)
15

Description

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

And applied it in my controller:
```cpp
class AuthController : public drogon::HttpController
{
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?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.