Package ch.astorm.smtp4j.auth
Class XOAuth2AuthenticationHandler
java.lang.Object
ch.astorm.smtp4j.auth.XOAuth2AuthenticationHandler
- All Implemented Interfaces:
SmtpAuthenticatorHandler
Handles
XOAUTH2 authentication scheme.
See here.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic XOAuth2AuthenticationHandlerSingleton instance of this handler. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(SmtpCommand command, SmtpExchangeHandler exchangeHandler, SmtpServerOptions options) Authenticates the client.getName()Returns the name of the SMTP authentication protocol.voidsetSessionProperties(Properties properties, SmtpServerOptions options) Callback to allow this authenticator to inject properties for theSessionif needed.
-
Field Details
-
INSTANCE
Singleton instance of this handler.
-
-
Constructor Details
-
XOAuth2AuthenticationHandler
public XOAuth2AuthenticationHandler()
-
-
Method Details
-
getName
Description copied from interface:SmtpAuthenticatorHandlerReturns the name of the SMTP authentication protocol.- Specified by:
getNamein interfaceSmtpAuthenticatorHandler- Returns:
- The protocol name, for instance
PLAIN.
-
authenticate
public boolean authenticate(SmtpCommand command, SmtpExchangeHandler exchangeHandler, SmtpServerOptions options) throws SmtpProtocolException Description copied from interface:SmtpAuthenticatorHandlerAuthenticates the client.- Specified by:
authenticatein interfaceSmtpAuthenticatorHandler- Parameters:
command- The initialAUTHcommand with its parameters.exchangeHandler- The exchange handler if challenge responses from the client is needed.options- The options.- Returns:
- true if the user has been authenticated, false otherwise (invalid credentials).
- Throws:
SmtpProtocolException
-
setSessionProperties
Description copied from interface:SmtpAuthenticatorHandlerCallback to allow this authenticator to inject properties for theSessionif needed.- Specified by:
setSessionPropertiesin interfaceSmtpAuthenticatorHandler- Parameters:
properties- The session properties.options- The options.
-