001/*
002 * Copyright 2022-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2022-2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2022-2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.logs.v2.text;
037
038
039
040import java.util.List;
041import java.util.Set;
042
043import com.unboundid.ldap.sdk.ResultCode;
044import com.unboundid.ldap.sdk.unboundidds.logs.AccessLogMessageType;
045import com.unboundid.ldap.sdk.unboundidds.logs.LogException;
046import com.unboundid.ldap.sdk.unboundidds.logs.v2.BindResultAccessLogMessage;
047import com.unboundid.util.NotMutable;
048import com.unboundid.util.NotNull;
049import com.unboundid.util.Nullable;
050import com.unboundid.util.ThreadSafety;
051import com.unboundid.util.ThreadSafetyLevel;
052
053
054
055/**
056 * This class provides a data structure that holds information about a
057 * text-formatted bind result access log message.
058 * <BR>
059 * <BLOCKQUOTE>
060 *   <B>NOTE:</B>  This class, and other classes within the
061 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
062 *   supported for use against Ping Identity, UnboundID, and
063 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
064 *   for proprietary functionality or for external specifications that are not
065 *   considered stable or mature enough to be guaranteed to work in an
066 *   interoperable way with other types of LDAP servers.
067 * </BLOCKQUOTE>
068 */
069@NotMutable()
070@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
071public final class TextFormattedBindResultAccessLogMessage
072       extends TextFormattedBindRequestAccessLogMessage
073       implements BindResultAccessLogMessage
074{
075  /**
076   * The serial version UID for this serializable class.
077   */
078  private static final long serialVersionUID = 3250258313916133793L;
079
080
081
082  // Indicates whether a retired password was used for the bind operation.
083  @Nullable private final Boolean retiredPasswordUsed;
084
085  // The authentication failure ID for this access log message.
086  @Nullable private final Long authenticationFailureID;
087
088  // The authentication DN for this access log message.
089  @Nullable private final String authenticationDN;
090
091  // The authentication failure message for this access log message.
092  @Nullable private final String authenticationFailureMessage;
093
094  // The authentication failure name for this access log message.
095  @Nullable private final String authenticationFailureName;
096
097  // The authorization DN for this access log message.
098  @Nullable private final String authorizationDN;
099
100  // The client connection policy name for this access log message.
101  @Nullable private final String clientConnectionPolicy;
102
103  // The forward helper for this access log message.
104  @NotNull private final TextFormattedForwardAccessLogMessageHelper
105       forwardHelper;
106
107  // The result helper for this access log message.
108  @NotNull private final TextFormattedResultAccessLogMessageHelper
109       resultHelper;
110
111
112
113  /**
114   * Creates a new text-formatted bind result access log message from the
115   * provided message string.
116   *
117   * @param  logMessageString  The string representation of this log message.
118   *                           It must not be {@code null}.
119   *
120   * @throws  LogException  If the provided string cannot be parsed as a valid
121   *                        log message.
122   */
123  public TextFormattedBindResultAccessLogMessage(
124              @NotNull final String logMessageString)
125         throws LogException
126  {
127    this(new TextFormattedLogMessage(logMessageString));
128  }
129
130
131
132  /**
133   * Creates a new text-formatted bind result access log message from the
134   * provided message.
135   *
136   * @param  logMessage  The log message to use to create this bind result
137   *                     access log message.  It must not be {@code null}.
138   */
139  TextFormattedBindResultAccessLogMessage(
140       @NotNull final TextFormattedLogMessage logMessage)
141  {
142    super(logMessage);
143
144    authenticationDN =
145         getString(TextFormattedAccessLogFields.BIND_AUTHENTICATION_DN);
146    authorizationDN =
147         getString(TextFormattedAccessLogFields.BIND_AUTHORIZATION_DN);
148    retiredPasswordUsed = getBooleanNoThrow(
149         TextFormattedAccessLogFields.BIND_RETIRED_PASSWORD_USED);
150    clientConnectionPolicy =
151         getString(TextFormattedAccessLogFields.CLIENT_CONNECTION_POLICY);
152    authenticationFailureID = getLongNoThrow(
153         TextFormattedAccessLogFields.BIND_AUTHENTICATION_FAILURE_ID);
154    authenticationFailureName = getString(
155         TextFormattedAccessLogFields.BIND_AUTHENTICATION_FAILURE_NAME);
156    authenticationFailureMessage = getString(
157         TextFormattedAccessLogFields.BIND_AUTHENTICATION_FAILURE_REASON);
158
159    resultHelper = new TextFormattedResultAccessLogMessageHelper(this);
160    forwardHelper = new TextFormattedForwardAccessLogMessageHelper(this);
161  }
162
163
164
165  /**
166   * {@inheritDoc}
167   */
168  @Override()
169  @NotNull()
170  public AccessLogMessageType getMessageType()
171  {
172    return AccessLogMessageType.RESULT;
173  }
174
175
176
177  /**
178   * {@inheritDoc}
179   */
180  @Override()
181  @Nullable()
182  public ResultCode getResultCode()
183  {
184    return resultHelper.getResultCode();
185  }
186
187
188
189  /**
190   * {@inheritDoc}
191   */
192  @Override()
193  @Nullable()
194  public String getDiagnosticMessage()
195  {
196    return resultHelper.getDiagnosticMessage();
197  }
198
199
200
201  /**
202   * {@inheritDoc}
203   */
204  @Override()
205  @Nullable()
206  public String getAdditionalInformation()
207  {
208    return resultHelper.getAdditionalInformation();
209  }
210
211
212
213  /**
214   * {@inheritDoc}
215   */
216  @Override()
217  @Nullable()
218  public String getMatchedDN()
219  {
220    return resultHelper.getMatchedDN();
221  }
222
223
224
225  /**
226   * {@inheritDoc}
227   */
228  @Override()
229  @NotNull()
230  public List<String> getReferralURLs()
231  {
232    return resultHelper.getReferralURLs();
233  }
234
235
236
237  /**
238   * {@inheritDoc}
239   */
240  @Override()
241  @Nullable()
242  public Double getProcessingTimeMillis()
243  {
244    return resultHelper.getProcessingTimeMillis();
245  }
246
247
248
249  /**
250   * {@inheritDoc}
251   */
252  @Override()
253  @Nullable()
254  public Double getWorkQueueWaitTimeMillis()
255  {
256    return resultHelper.getWorkQueueWaitTimeMillis();
257  }
258
259
260
261  /**
262   * {@inheritDoc}
263   */
264  @Override()
265  @NotNull()
266  public Set<String> getResponseControlOIDs()
267  {
268    return resultHelper.getResponseControlOIDs();
269  }
270
271
272
273  /**
274   * {@inheritDoc}
275   */
276  @Override()
277  @Nullable()
278  public Long getIntermediateResponsesReturned()
279  {
280    return resultHelper.getIntermediateResponsesReturned();
281  }
282
283
284
285  /**
286   * {@inheritDoc}
287   */
288  @Override()
289  @NotNull()
290  public List<String> getServersAccessed()
291  {
292    return resultHelper.getServersAccessed();
293  }
294
295
296
297  /**
298   * {@inheritDoc}
299   */
300  @Override()
301  @Nullable()
302  public Boolean getUncachedDataAccessed()
303  {
304    return resultHelper.getUncachedDataAccessed();
305  }
306
307
308
309  /**
310   * {@inheritDoc}
311   */
312  @Override()
313  @NotNull()
314  public Set<String> getUsedPrivileges()
315  {
316    return resultHelper.getUsedPrivileges();
317  }
318
319
320
321  /**
322   * {@inheritDoc}
323   */
324  @Override()
325  @NotNull()
326  public Set<String> getPreAuthorizationUsedPrivileges()
327  {
328    return resultHelper.getPreAuthorizationUsedPrivileges();
329  }
330
331
332
333  /**
334   * {@inheritDoc}
335   */
336  @Override()
337  @NotNull()
338  public Set<String> getMissingPrivileges()
339  {
340    return resultHelper.getMissingPrivileges();
341  }
342
343
344
345  /**
346   * Retrieves a string representation of an intermediate client response
347   * control included in the log message.
348   *
349   * @return  A string representation of an intermediate client response control
350   *          included in the log message, or {@code null} if there is none.
351   */
352  @Nullable()
353  public String getIntermediateClientResponseControl()
354  {
355    return resultHelper.getIntermediateClientResponseControl();
356  }
357
358
359
360  /**
361   * {@inheritDoc}
362   */
363  @Override()
364  @Nullable()
365  public String getTargetHost()
366  {
367    return forwardHelper.getTargetHost();
368  }
369
370
371
372  /**
373   * {@inheritDoc}
374   */
375  @Override()
376  @Nullable()
377  public Integer getTargetPort()
378  {
379    return forwardHelper.getTargetPort();
380  }
381
382
383
384  /**
385   * {@inheritDoc}
386   */
387  @Override()
388  @Nullable()
389  public String getTargetProtocol()
390  {
391    return forwardHelper.getTargetProtocol();
392  }
393
394
395
396  /**
397   * {@inheritDoc}
398   */
399  @Override()
400  @Nullable()
401  public String getAuthenticationDN()
402  {
403    return authenticationDN;
404  }
405
406
407
408  /**
409   * {@inheritDoc}
410   */
411  @Override()
412  @Nullable()
413  public String getAuthorizationDN()
414  {
415    return authorizationDN;
416  }
417
418
419
420  /**
421   * {@inheritDoc}
422   */
423  @Override()
424  @Nullable()
425  public Long getAuthenticationFailureID()
426  {
427    return authenticationFailureID;
428  }
429
430
431
432  /**
433   * {@inheritDoc}
434   */
435  @Override()
436  @Nullable()
437  public String getAuthenticationFailureName()
438  {
439    return authenticationFailureName;
440  }
441
442
443
444  /**
445   * {@inheritDoc}
446   */
447  @Override()
448  @Nullable()
449  public String getAuthenticationFailureMessage()
450  {
451    return authenticationFailureMessage;
452  }
453
454
455
456  /**
457   * {@inheritDoc}
458   */
459  @Override()
460  @Nullable()
461  public Boolean getRetiredPasswordUsed()
462  {
463    return retiredPasswordUsed;
464  }
465
466
467
468  /**
469   * {@inheritDoc}
470   */
471  @Override()
472  @Nullable()
473  public String getClientConnectionPolicy()
474  {
475    return clientConnectionPolicy;
476  }
477}