forked from greenmail-mail-test/greenmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginAuthenticationState.java
45 lines (38 loc) · 1.41 KB
/
LoginAuthenticationState.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.icegreen.greenmail.smtp.auth;
import com.icegreen.greenmail.smtp.commands.AuthCommand.AuthMechanism;
/**
* Details from the {@link AuthMechanism#LOGIN} authorization mechanism, when
* that mechanism was used for authentication.
*/
public class LoginAuthenticationState implements AuthenticationState, UsernameAuthentication {
private final String username;
private final String password;
/**
* @param username The username from the AUTH command.
* @param password The password from the AUTH command.
*/
public LoginAuthenticationState(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public String getType() {
return AuthMechanism.LOGIN.name();
}
/**
* Retrieves the username that was used for {@code PLAIN} or {@code LOGIN} authentication.
* Note that this will return {@code null} when no authentication was performed or needed.
* @return The username from the AUTH command.
*/
public String getUsername() {
return username;
}
/**
* Retrieves the password that was used for {@code PLAIN} or {@code LOGIN} authentication.
* Note that this will return {@code null} when no authentication was performed or needed.
* @return The password from the AUTH command.
*/
public String getPassword() {
return password;
}
}