Class RecentLoginHistoryAttempt
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.controls.RecentLoginHistoryAttempt
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<RecentLoginHistoryAttempt>
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class RecentLoginHistoryAttempt extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<RecentLoginHistoryAttempt>
This class provides a data structure with information about a recent login attempt for a user.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
-
-
Constructor Summary
Constructors Constructor Description RecentLoginHistoryAttempt(boolean successful, long timestamp, java.lang.String authenticationMethod, java.lang.String clientIPAddress, java.lang.String failureReason, java.lang.Long additionalAttemptCount)
Creates a new recent login history attempt object with the provided information.RecentLoginHistoryAttempt(JSONObject jsonObject)
Creates a new recent login history attempt object that is decoded from the provided JSON object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSONObject
asJSONObject()
Retrieves a JSON object with an encoded representation of this recent login history attempt.int
compareTo(RecentLoginHistoryAttempt a)
Retrieves an integer value that indicates the order of the provided recent login history attempt relative to this attempt in a sorted list.boolean
equals(java.lang.Object o)
Indicates whether the provided object is logically equivalent to this recent login history attempt object.java.lang.Long
getAdditionalAttemptCount()
Retrieves the number of additional authentication attempts that occurred on the same date (in the UTC time zone) as the timestamp for this attempt and had the same values for the successful, authentication method, client IP address, and failure reason fields.java.lang.String
getAuthenticationMethod()
Retrieves the name of the authentication method that the client used.java.lang.String
getClientIPAddress()
Retrieves the IP address of the client that made the authentication attempt, if available.java.lang.String
getFailureReason()
Retrieves a general reason that the authentication attempt failed, if appropriate.java.util.Date
getTimestamp()
Retrieves the time that the authentication attempt occurred.int
hashCode()
Retrieves a hash code for this recent login history attempt.boolean
isSuccessful()
Indicates whether this recent login history attempt is for a successful login.java.lang.String
toString()
Retrieves a string representation of this recent login history attempt.
-
-
-
Constructor Detail
-
RecentLoginHistoryAttempt
public RecentLoginHistoryAttempt(boolean successful, long timestamp, @NotNull java.lang.String authenticationMethod, @Nullable java.lang.String clientIPAddress, @Nullable java.lang.String failureReason, @Nullable java.lang.Long additionalAttemptCount)
Creates a new recent login history attempt object with the provided information.- Parameters:
successful
- Indicates whether the attempt was successful.timestamp
- The time of the authentication attempt.authenticationMethod
- The name of the authentication method used for the attempt. This must not benull
or empty.clientIPAddress
- The IP address of the client that made the authentication attempt. This may benull
if no client IP address is available.failureReason
- A general reason that the authentication attempt failed. It must benull
if the attempt succeeded and must not benull
if the attempt failed. If provided, the value should be one of theFAILURE_NAME_
* constants in theAuthenticationFailureReason
class.additionalAttemptCount
- The number of additional authentication attempts that occurred on the same date (in the UTC time zone) as the provided timestamp with the same values for the successful, authentication method, client IP address, and failure reason fields. It may benull
if this should not be included (e.g., if information about similar attempts should not be collapsed).
-
RecentLoginHistoryAttempt
public RecentLoginHistoryAttempt(@NotNull JSONObject jsonObject) throws LDAPException
Creates a new recent login history attempt object that is decoded from the provided JSON object.- Parameters:
jsonObject
- A JSON object containing an encoded representation of the attempt. It must not benull
.- Throws:
LDAPException
- If a problem occurs while attempting to decode the provided JSON object as a recent login history attempt.
-
-
Method Detail
-
isSuccessful
public boolean isSuccessful()
Indicates whether this recent login history attempt is for a successful login.- Returns:
true
if this recent login history attempt is for a successful login, orfalse
if it is for a failed login.
-
getTimestamp
@NotNull public java.util.Date getTimestamp()
Retrieves the time that the authentication attempt occurred.- Returns:
- The time that the authentication attempt occurred.
-
getAuthenticationMethod
@NotNull public java.lang.String getAuthenticationMethod()
Retrieves the name of the authentication method that the client used. The value should generally be one of "simple" (for LDAP simple authentication), "internal" (if the authentication occurred internally within the server), or "SASL {mechanism}" (if the client authenticated via some SASL mechanism).- Returns:
- The name of the authentication method that the client used.
-
getClientIPAddress
@Nullable public java.lang.String getClientIPAddress()
Retrieves the IP address of the client that made the authentication attempt, if available.- Returns:
- The IP address of the client that made the authentication attempt,
or
null
if no client IP address is available (e.g., because the client authenticated through some internal mechanism).
-
getFailureReason
@Nullable public java.lang.String getFailureReason()
Retrieves a general reason that the authentication attempt failed, if appropriate.- Returns:
- A general reason that the authentication attempt failed, or
null
if the attempt was successful.
-
getAdditionalAttemptCount
@Nullable public java.lang.Long getAdditionalAttemptCount()
Retrieves the number of additional authentication attempts that occurred on the same date (in the UTC time zone) as the timestamp for this attempt and had the same values for the successful, authentication method, client IP address, and failure reason fields.- Returns:
- The number of additional similar authentication attempts that
occurred on the same date as this attempt, or
null
if this is not available (e.g., because the server is not configured to collapse information about multiple similar attempts into a single record).
-
asJSONObject
@NotNull public JSONObject asJSONObject()
Retrieves a JSON object with an encoded representation of this recent login history attempt.- Returns:
- A JSON object with an encoded representation of this recent long history attempt.
-
equals
public boolean equals(@Nullable java.lang.Object o)
Indicates whether the provided object is logically equivalent to this recent login history attempt object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object for which to make the determination.- Returns:
true
if the provided object is logically equivalent to this recent login history attempt object, orfalse
if not.
-
hashCode
public int hashCode()
Retrieves a hash code for this recent login history attempt.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for this recent login history attempt.
-
compareTo
public int compareTo(@NotNull RecentLoginHistoryAttempt a)
Retrieves an integer value that indicates the order of the provided recent login history attempt relative to this attempt in a sorted list.- Specified by:
compareTo
in interfacejava.lang.Comparable<RecentLoginHistoryAttempt>
- Parameters:
a
- The recent login history attempt to compare to this attempt. It must not benull
.- Returns:
- A negative value integer if this attempt should be ordered before the provided attempt in a sorted list, a positive integer if this attempt should be ordered after the provided attempt, or zero if they are logically equivalent.
-
-