@Deprecated public class POP3Authenticator extends Object implements Authenticator
Authenticator
interface that authenticates a user against a POP3 server. This means
that all users having an email account on a specified mail server are
able to log in to base using the same username and password as they use
to read their mails.
Example
String host = "mail.thep.lu.se"; String login = "nicklas"; String password = "secret"; Authenticator a = new POP3Authenticator(); a.init(host); if (a.authenticate(login, password)) { // Do some stuff that only nicklas is allowed to do! }
Modifier and Type | Field and Description |
---|---|
private String |
host
Deprecated.
The address or IP-number to the POP3 host.
|
private int |
port
Deprecated.
The POP3 port to use.
|
Constructor and Description |
---|
POP3Authenticator()
Deprecated.
Create a new
POP3Authenticator object. |
Modifier and Type | Method and Description |
---|---|
AuthenticationInformation |
authenticate(String login,
String password)
Deprecated.
Authenticates a user against the POP3 server.
|
void |
init(String settings)
Deprecated.
Initialises the object.
|
private String |
send(String cmd,
BufferedWriter out,
BufferedReader in)
Deprecated.
Send
cmd to the out buffer. |
boolean |
supportsExtraInformation()
Deprecated.
Always return FALSE.
|
private String host
private int port
public POP3Authenticator()
POP3Authenticator
object.public void init(String settings) throws AuthenticationException
settings
string should be the address or
IP-number to the POP3 server. Optionally, the name/number may be followed by
a colon (:) and a port number. For example: pop.yourdomain.com
or pop.yourdomain.com:110
init
in interface Authenticator
settings
- The host name with an optional port numberAuthenticationException
- This exception is thrown if the format
of the settings
string is invalid. No check is made that
the host actually exists and answers at the specified port.public boolean supportsExtraInformation()
supportsExtraInformation
in interface Authenticator
AuthenticationInformation
,
Authenticator.authenticate(String,String)
public AuthenticationInformation authenticate(String login, String password) throws UnknownLoginException, InvalidPasswordException, AuthenticationException
authenticate
in interface Authenticator
login
- The login name of the userpassword
- The password for the userAuthenticationInformation
object. The id
is the same as
the login
. No extra information
is returned.UnknownLoginException
- This exception may be thrown if the
server doesn't know about the user. It is also possible for an
implmentation to throw an AuthenticationException
InvalidPasswordException
- This exception may be thrown if the
password is invalid. It is also possible for an implementation to throw
an AuthenticationException
AuthenticationException
- This exception is thrown if the
authentication failsprivate String send(String cmd, BufferedWriter out, BufferedReader in) throws Exception
cmd
to the out
buffer. Read a single line
of response from the in
buffer.Exception