2727import org .labkey .api .security .AuthenticationConfiguration .PrimaryAuthenticationConfiguration ;
2828import org .labkey .api .security .AuthenticationConfiguration .SSOAuthenticationConfiguration ;
2929import org .labkey .api .security .AuthenticationConfiguration .SecondaryAuthenticationConfiguration ;
30+ import org .labkey .api .security .AuthenticationManager .AuthenticationStatus ;
3031import org .labkey .api .security .AuthenticationManager .AuthenticationValidator ;
3132import org .labkey .api .security .ValidEmail .InvalidEmailException ;
3233import org .labkey .api .settings .StandardStartupPropertyHandler ;
@@ -452,14 +453,14 @@ public AuthenticationResponse setRequireSecondary(boolean requireSecondary)
452453 // hackers). We try to be as specific as possible.
453454 enum FailureReason
454455 {
455- userDoesNotExist (ReportType .onFailure , "user does not exist" ),
456- badPassword (ReportType .onFailure , "incorrect password" ),
457- badCredentials (ReportType .onFailure , "invalid credentials" ), // Use for cases where we can't distinguish between userDoesNotExist and badPassword
458- complexity (ReportType .onFailure , "password does not meet the complexity requirements" ),
459- expired (ReportType .onFailure , "password has expired" ),
460- configurationError (ReportType .always , "configuration problem" ),
461- notApplicable (ReportType .never , "not applicable" ),
462- badApiKey (ReportType .onFailure , "invalid API key" ) {
456+ userDoesNotExist (ReportType .onFailure , "user does not exist" , null ),
457+ badPassword (ReportType .onFailure , "incorrect password" , null ),
458+ badCredentials (ReportType .onFailure , "invalid credentials" , null ), // Use for cases where we can't distinguish between userDoesNotExist and badPassword
459+ complexity (ReportType .onFailure , "password does not meet the complexity requirements" , AuthenticationStatus . Complexity ),
460+ expired (ReportType .onFailure , "password has expired" , AuthenticationStatus . PasswordExpired ),
461+ configurationError (ReportType .always , "configuration problem" , null ),
462+ notApplicable (ReportType .never , "not applicable" , null ),
463+ badApiKey (ReportType .onFailure , "invalid API key" , AuthenticationStatus . BadApiKey ) {
463464 @ Override
464465 public @ Nullable String getEmailAddress (ValidEmail email ) throws InvalidEmailException
465466 {
@@ -471,11 +472,13 @@ enum FailureReason
471472
472473 private final ReportType _type ;
473474 private final String _message ;
475+ private final @ Nullable AuthenticationStatus _associatedStatus ;
474476
475- FailureReason (ReportType type , String message )
477+ FailureReason (ReportType type , String message , @ Nullable AuthenticationStatus associatedStatus )
476478 {
477479 _type = type ;
478480 _message = message ;
481+ _associatedStatus = associatedStatus ;
479482 }
480483
481484 public ReportType getReportType ()
@@ -492,6 +495,11 @@ public String getMessage()
492495 {
493496 return email .getEmailAddress ();
494497 }
498+
499+ public @ Nullable AuthenticationStatus getAssociatedStatus ()
500+ {
501+ return _associatedStatus ;
502+ }
495503 }
496504
497505 enum ReportType
0 commit comments