Вход через Jambotron (OAuth 2.0 code + PKCE), пароли приложений, системные ящики
continuous-integration/drone/pr Build is passing
continuous-integration/drone/pr Build is passing
- /api/oauth/start → JAMBOTRON_URL/oauth/authorize (client mail, PKCE S256); /api/oauth/callback: код меняется на сервере у Jambotron /api/oauth/token (Bearer SERVICE_TOKEN) → рабочий ящик сотрудника → сессия, ADMIN Jambotron — ADMIN. - Вход по паролю в веб — только встроенный администратор (когда вход через Jambotron включён). - Пароли приложений (V9 app_passwords): User panel → APP PASSWORDS, только SMTP/IMAP. - Системные ящики (V9 users.is_system): без входа в веб, открывают встроенные администраторы, не в USERS; Admin panel → MAILBOXES → кнопка SYSTEM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.mailserver.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* «Sign in with Jambotron»: JAMBOTRON_URL (https://jambotron.com) + SERVICE_TOKEN (the same token Jambotron uses for
|
||||
* the service API — here it proves to Jambotron that the code is exchanged by this mail server). Both set — people log
|
||||
* in through Jambotron, web password login only for the built-in administrator.
|
||||
*/
|
||||
@Component
|
||||
public class JambotronSso {
|
||||
|
||||
private final String url;
|
||||
private final String token;
|
||||
private final String publicUrl;
|
||||
|
||||
public JambotronSso(@Value("${mailserver.jambotron.url:}") String url,
|
||||
@Value("${mailserver.service-token:}") String token,
|
||||
@Value("${mailserver.public-url:}") String publicUrl,
|
||||
@Value("${mailserver.smtp.hostname:localhost}") String hostname) {
|
||||
this.url = url.isBlank() ? null : url.trim().replaceAll("/+$", "");
|
||||
this.token = token.isBlank() ? null : token.trim();
|
||||
this.publicUrl = publicUrl.isBlank() ? "https://" + hostname : publicUrl.trim().replaceAll("/+$", "");
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return url != null && token != null;
|
||||
}
|
||||
|
||||
public String url() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String token() {
|
||||
return token;
|
||||
}
|
||||
|
||||
/** Where Jambotron sends the browser back: https://mail.jambocheck.com/api/oauth/callback */
|
||||
public String callback() {
|
||||
return publicUrl + "/api/oauth/callback";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user