profcomff / profcomff/auth-api

Mailu forward_auth handler

Open
#200 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue :baby: new feature :new:
Dominant language
Python
Stars
15
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Issue open by Roman Dyakov via telegram message.

Есть стандарт для прокси-аутентификации, его поддерживает caddy с помощью директивы forward_auth


forward_auth /sso/login http://com_profcomff_api_auth:80 {
    uri /auth/mailu/check
    copy_headers {
        X-Auth-Request-Email>X-Auth-Email
    }
}

При запросе на mail.profcomff.com/sso/login делай запрос на http://com_profcomff_api_auth/auth/mailu/check, если результат 202 – передай значение заголовка X-Auth-Request-Email как заголовок X-Auth-Email далее. Если 403 – ничего не делай

Токен передается из Твой ФФ в виде GET-параметра и можно проставить его в куки через кэдди файл


handle /sso/login/tvoy-ff {
    header {
        Set-Cookie "TOKEN={http.request.uri.query.token}; SameSite=None; Secure;"
    }
    redir https://mail.profcomff.com/webmail
}

Итого остается написать для Mailu ручку внутри плагина авторизации, которая будет возвращать 202 если в куки TOKEN находится валидный токен с правильным скопом, иначе 403

+создать INTERNAL кнопку в services на https://mail.profcomff.com/sso/login/tvoy-ff

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Mailu authorization plugin and the services configuration mentioned in the issue. Trace requests to auth/mailu/check and how the TOKEN cookie is validated, then verify the 202/403 behavior and the INTERNAL button URL at /sso/login/tvoy-ff.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.