![JAR search and dependency download from the Maven repository](/logo.png)
com.unboundid.ldap.sdk.unboundidds.extensions.SupportedOTPDeliveryMechanismInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unboundid-ldapsdk Show documentation
Show all versions of unboundid-ldapsdk Show documentation
The UnboundID LDAP SDK for Java is a fast, comprehensive, and easy-to-use
Java API for communicating with LDAP directory servers and performing
related tasks like reading and writing LDIF, encoding and decoding data
using base64 and ASN.1 BER, and performing secure communication. This
package contains the Standard Edition of the LDAP SDK, which is a
complete, general-purpose library for communicating with LDAPv3 directory
servers.
/*
* Copyright 2015-2018 Ping Identity Corporation
* All Rights Reserved.
*/
/*
* Copyright (C) 2015-2018 Ping Identity Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPLv2 only)
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see .
*/
package com.unboundid.ldap.sdk.unboundidds.extensions;
import java.io.Serializable;
import com.unboundid.util.NotMutable;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import com.unboundid.util.Validator;
/**
* This class provides a data structure with information about a one-time
* password delivery mechanism that is supported by the Directory Server and may
* or may not be supported for a particular user.
*
*
* NOTE: This class, and other classes within the
* {@code 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.
*
*/
@NotMutable()
@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
public final class SupportedOTPDeliveryMechanismInfo
implements Serializable
{
/**
* The serial version UID for this serializable class.
*/
private static final long serialVersionUID = -6315998976212985213L;
// Indicates whether the delivery mechanism is supported for the user targeted
// by the get supported OTP delivery mechanisms extended request.
private final Boolean isSupported;
// The name of the OTP delivery mechanism.
private final String deliveryMechanism;
// An optional recipient ID that may be used for the target user in
// conjunction with the delivery mechanism.
private final String recipientID;
/**
* Creates a new supported OTP delivery mechanism info object with the
* provided information.
*
* @param deliveryMechanism The name of the one-time password delivery
* mechanism to which this object corresponds.
* @param isSupported Indicates whether the specified delivery
* mechanism is expected to be supported for the
* target user. This may be {@code true} (to
* indicate that the delivery mechanism is expected
* to be supported for the target user,
* {@code false} if the delivery mechanism is not
* supported for the target user, or {@code null}
* if it cannot be determined whether the delivery
* mechanism is supported for the target user.
* @param recipientID An optional recipient ID that can be used in
* conjunction with the delivery mechanism if it
* is supported for the user (e.g., it may be an
* email address for an email-based delivery
* mechanism or a mobile phone number for an
* SMS-based delivery mechanism). This may be
* {@code null} if the delivery mechanism is not
* supported or if no recipient ID is applicable.
*/
public SupportedOTPDeliveryMechanismInfo(final String deliveryMechanism,
final Boolean isSupported,
final String recipientID)
{
Validator.ensureNotNull(deliveryMechanism);
this.deliveryMechanism = deliveryMechanism;
this.isSupported = isSupported;
this.recipientID = recipientID;
}
/**
* Retrieves the name of the one-time password delivery mechanism to which
* this object corresponds.
*
* @return The name of the one-time password delivery mechanism to which this
* object corresponds.
*/
public String getDeliveryMechanism()
{
return deliveryMechanism;
}
/**
* Retrieves information about whether the one-time password delivery
* mechanism is supported for the target user.
*
* @return {@code true} if the delivery mechanism is expected to be supported
* for the user, {@code false} if the delivery mechanism is not
* supported for the user, or {@code null} if it cannot be determined
* whether the delivery mechanism is supported for the target user.
*/
public Boolean isSupported()
{
return isSupported;
}
/**
* Retrieves the recipient ID, if any, that may be used for the target user
* in conjunction with the associated delivery mechanism. If a recipient ID
* is available, then its format may vary based on the type of delivery
* mechanism.
*
* @return The recipient ID that may be used for the target user in
* conjunction with the associated delivery mechanism, or
* {@code null} if there is no recipient ID associated with the
* delivery mechanism, or if the delivery mechanism is not expected
* to be supported for the target user.
*/
public String getRecipientID()
{
return recipientID;
}
/**
* Retrieves a hash code for this supported OTP delivery mechanism info
* object.
*
* @return A hash code for this supported OTP delivery mechanism info object.
*/
@Override()
public int hashCode()
{
int hc = deliveryMechanism.hashCode();
if (isSupported == null)
{
hc += 2;
}
else if (isSupported)
{
hc++;
}
if (recipientID != null)
{
hc += recipientID.hashCode();
}
return hc;
}
/**
* Indicates whether the provided object is considered equal to this supported
* OTP delivery mechanism info object.
*
* @param o The object for which to make the determination.
*
* @return {@code true} if the provided object is an equivalent supported OTP
* delivery mechanism info object, or {@code false} if not.
*/
@Override()
public boolean equals(final Object o)
{
if (o == this)
{
return true;
}
if (! (o instanceof SupportedOTPDeliveryMechanismInfo))
{
return false;
}
final SupportedOTPDeliveryMechanismInfo i =
(SupportedOTPDeliveryMechanismInfo) o;
if (! deliveryMechanism.equals(i.deliveryMechanism))
{
return false;
}
if (isSupported == null)
{
if (i.isSupported != null)
{
return false;
}
}
else
{
if (! isSupported.equals(i.isSupported))
{
return false;
}
}
if (recipientID == null)
{
return (i.recipientID == null);
}
else
{
return recipientID.equals(i.recipientID);
}
}
/**
* Retrieves a string representation of this supported OTP delivery mechanism
* info object.
*
* @return A string representation of this supported OTP delivery mechanism
* object.
*/
@Override()
public String toString()
{
final StringBuilder buffer = new StringBuilder();
toString(buffer);
return buffer.toString();
}
/**
* Appends a string representation of this supported OTP delivery mechanism
* info object to the provided buffer.
*
* @param buffer The buffer to which the information should be appended.
*/
public void toString(final StringBuilder buffer)
{
buffer.append("SupportedOTPDeliveryMechanismInfo(mechanism='");
buffer.append(deliveryMechanism);
buffer.append('\'');
if (isSupported != null)
{
buffer.append(", isSupported=");
buffer.append(isSupported);
}
if (recipientID != null)
{
buffer.append(", recipientID='");
buffer.append(recipientID);
buffer.append('\'');
}
buffer.append(')');
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy