please go through
https://www.sharpencode.com/article/WebApi/authentication-authorization/basic-authentication
here i have explained to implement basic authentication with Authentication filter.
let me know if you have any issue.