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