34
34
import org .slf4j .Logger ;
35
35
import org .slf4j .LoggerFactory ;
36
36
37
+ import com .ecyrd .speed4j .StopWatch ;
37
38
import com .elasticinbox .core .account .authenticator .AuthenticationException ;
38
39
import com .elasticinbox .core .account .authenticator .AuthenticatorFactory ;
39
40
import com .elasticinbox .core .account .authenticator .IAuthenticator ;
40
41
import com .elasticinbox .core .account .validator .IValidator ;
41
42
import com .elasticinbox .core .account .validator .ValidatorFactory ;
42
43
import com .elasticinbox .core .account .validator .IValidator .AccountStatus ;
43
44
import com .elasticinbox .core .model .Mailbox ;
45
+ import com .elasticinbox .pop3 .Activator ;
44
46
45
47
/**
46
48
* POP3 Authentication Handler (AUTH)
@@ -69,6 +71,8 @@ protected org.apache.james.protocols.pop3.mailbox.Mailbox auth(POP3Session sessi
69
71
logger .debug ("POP3: Authenticating session {}, user {}, pass {}" ,
70
72
new Object [] { session .getSessionID (), username , password });
71
73
74
+ StopWatch stopWatch = Activator .getDefault ().getStopWatch ();
75
+
72
76
try {
73
77
// authenticate mailbox, if failed return null
74
78
AccountStatus status = validator .getAccountStatus (username );
@@ -81,12 +85,16 @@ protected org.apache.james.protocols.pop3.mailbox.Mailbox auth(POP3Session sessi
81
85
// authenticate user with password
82
86
mailbox = authenticator .authenticate (username , password );
83
87
88
+ stopWatch .stop ("AUTH.success" );
89
+
84
90
// return POP3 handler for mailbox
85
91
return backend .getMailboxHander (mailbox );
86
92
} catch (IllegalArgumentException iae ) {
93
+ stopWatch .stop ("AUTH.fail" );
87
94
logger .debug ("POP3 Authentication failed. Invalid username [{}]: {}" , username , iae .getMessage ());
88
95
return null ;
89
96
} catch (AuthenticationException ae ) {
97
+ stopWatch .stop ("AUTH.fail" );
90
98
logger .debug ("POP3 Authentication failed. Invalid username [{}] or password [{}]" , username , password );
91
99
return null ;
92
100
}
0 commit comments