39장. mail Microsoft Oauth
Camel 3.18.4 이후.
mail Microsoft OAuth2는 org.apache.camel.component.mail.mail.>-<Authenticator
를 구현하여 skopeo/POP/SMTP 연결을 인증하고 Spring의 mail 지원 및 기본 Java3-4 시스템을 통해 이메일에 액세스할 수 있습니다.
이 구성 요소에 대해 pom.xml
에 다음 종속성을 추가합니다.
camel-mail-microsoft-oauth
가져오기는 camel-mail 구성 요소를 자동으로 가져옵니다.
39.1. Microsoft Exchange Online OAuth2 mail Authenticator Authenticator sample 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
OAuth를 사용하려면 Azure Active Directory에 애플리케이션을 등록해야 합니다. 지침에 따라 새 애플리케이션을 등록합니다.
절차
- 애플리케이션을 사용하여 클라이언트 자격 증명 흐름을 통해 Exchange loss에 액세스할 수 있습니다. 자세한 내용은 OAuth를 사용한 Manila, POP 또는 SMTP 연결을참조하십시오.
-
모든 것이 설정되면 레지스트리,
org.apache.camel.component.mail.MicrosoftExchangeOnlineOAuth2>-<Authenticator
의 인스턴스 레지스트리를 선언하고 등록합니다. - 예를 들어 Spring Boot 애플리케이션에서는 다음을 수행합니다.
@BindToRegistry("auth") public MicrosoftExchangeOnlineOAuth2MailAuthenticator exchangeAuthenticator(){ return new MicrosoftExchangeOnlineOAuth2MailAuthenticator(tenantId, clientId, clientSecret, "jon@doe.com"); }
@BindToRegistry("auth")
public MicrosoftExchangeOnlineOAuth2MailAuthenticator exchangeAuthenticator(){
return new MicrosoftExchangeOnlineOAuth2MailAuthenticator(tenantId, clientId, clientSecret, "jon@doe.com");
}
- 그런 다음 Camel URI에서 다음과 같이 참조합니다.
from("imaps://outlook.office365.com:993" + "?authenticator=#auth" + "&mail.imaps.auth.mechanisms=XOAUTH2" + "&debugMode=true" + "&delete=false")
from("imaps://outlook.office365.com:993"
+ "?authenticator=#auth"
+ "&mail.imaps.auth.mechanisms=XOAUTH2"
+ "&debugMode=true"
+ "&delete=false")