001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2010 Sun Microsystems, Inc. 015 * Portions copyright 2012 ForgeRock AS. 016 */ 017 018package org.forgerock.opendj.ldap.responses; 019 020import java.util.List; 021 022import org.forgerock.opendj.ldap.ByteString; 023import org.forgerock.opendj.ldap.DecodeException; 024import org.forgerock.opendj.ldap.DecodeOptions; 025import org.forgerock.opendj.ldap.ResultCode; 026import org.forgerock.opendj.ldap.controls.Control; 027import org.forgerock.opendj.ldap.controls.ControlDecoder; 028 029/** 030 * The password modify extended result as defined in RFC 3062. The result 031 * includes the generated password, if requested, but only if the modify request 032 * succeeded. 033 * 034 * @see org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest 035 * @see <a href="http://tools.ietf.org/html/rfc3062">RFC 3062 - LDAP Password 036 * Modify Extended Operation </a> 037 */ 038public interface PasswordModifyExtendedResult extends ExtendedResult { 039 040 @Override 041 PasswordModifyExtendedResult addControl(Control control); 042 043 @Override 044 PasswordModifyExtendedResult addReferralURI(String uri); 045 046 @Override 047 Throwable getCause(); 048 049 @Override 050 <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) 051 throws DecodeException; 052 053 @Override 054 List<Control> getControls(); 055 056 @Override 057 String getDiagnosticMessage(); 058 059 /** 060 * Returns the newly generated password, but only if the password modify 061 * request succeeded and a generated password was requested. 062 * 063 * @return The newly generated password, or {@code null} if the password 064 * modify request failed or a generated password was not requested. 065 */ 066 byte[] getGeneratedPassword(); 067 068 @Override 069 String getMatchedDN(); 070 071 @Override 072 String getOID(); 073 074 @Override 075 List<String> getReferralURIs(); 076 077 @Override 078 ResultCode getResultCode(); 079 080 @Override 081 ByteString getValue(); 082 083 @Override 084 boolean hasValue(); 085 086 @Override 087 boolean isReferral(); 088 089 @Override 090 boolean isSuccess(); 091 092 @Override 093 PasswordModifyExtendedResult setCause(Throwable cause); 094 095 @Override 096 PasswordModifyExtendedResult setDiagnosticMessage(String message); 097 098 /** 099 * Sets the generated password. 100 * 101 * @param password 102 * The generated password, or {@code null} if there is no 103 * generated password associated with this result. 104 * @return This password modify result. 105 * @throws UnsupportedOperationException 106 * If this password modify extended result does not permit the 107 * generated password to be set. 108 */ 109 PasswordModifyExtendedResult setGeneratedPassword(byte[] password); 110 111 /** 112 * Sets the generated password. The password will be converted to a UTF-8 113 * octet string. 114 * 115 * @param password 116 * The generated password, or {@code null} if there is no 117 * generated password associated with this result. 118 * @return This password modify result. 119 * @throws UnsupportedOperationException 120 * If this password modify extended result does not permit the 121 * generated password to be set. 122 */ 123 PasswordModifyExtendedResult setGeneratedPassword(char[] password); 124 125 @Override 126 PasswordModifyExtendedResult setMatchedDN(String dn); 127 128 @Override 129 PasswordModifyExtendedResult setResultCode(ResultCode resultCode); 130 131}