Path: blob/master/src/java.base/share/classes/javax/security/auth/Destroyable.java
41159 views
/*1* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.security.auth;2627/**28* Objects such as credentials may optionally implement this interface29* to provide the capability to destroy its contents.30*31* @since 1.432* @see javax.security.auth.Subject33*/34public interface Destroyable {3536/**37* Destroy this {@code Object}.38*39* <p> Sensitive information associated with this {@code Object}40* is destroyed or cleared. Subsequent calls to certain methods41* on this {@code Object} will result in an42* {@code IllegalStateException} being thrown.43*44* @implSpec45* The default implementation throws {@code DestroyFailedException}.46*47* @exception DestroyFailedException if the destroy operation fails.48*49* @exception SecurityException if the caller does not have permission50* to destroy this {@code Object}.51*/52public default void destroy() throws DestroyFailedException {53throw new DestroyFailedException();54}5556/**57* Determine if this {@code Object} has been destroyed.58*59* @implSpec60* The default implementation returns false.61*62* @return true if this {@code Object} has been destroyed,63* false otherwise.64*/65public default boolean isDestroyed() {66return false;67}68}697071