< prev index next >

## src/java.security.jgss/share/classes/javax/security/auth/kerberos/DelegationPermission.java

Print this page

      1 /*
      2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
      3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      4  *
      5  * This code is free software; you can redistribute it and/or modify it
      6  * under the terms of the GNU General Public License version 2 only, as
      7  * published by the Free Software Foundation.  Oracle designates this
      8  * particular file as subject to the "Classpath" exception as provided
      9  * by Oracle in the LICENSE file that accompanied this code.
     10  *
     11  * This code is distributed in the hope that it will be useful, but WITHOUT
     12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14  * version 2 for more details (a copy is included in the LICENSE file that
     15  * accompanied this code).
     16  *
     17  * You should have received a copy of the GNU General Public License version
     18  * 2 along with this work; if not, write to the Free Software Foundation,
     19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     20  *
     21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     22  * or visit www.oracle.com if you need additional information or have any
    201      * Returns a PermissionCollection object for storing
    202      * DelegationPermission objects.
    203      * <br>
    204      * DelegationPermission objects must be stored in a manner that
    205      * allows them to be inserted into the collection in any order, but
    206      * that also enables the PermissionCollection implies method to
    207      * be implemented in an efficient (and consistent) manner.
    208      *
    209      * @return a new PermissionCollection object suitable for storing
    210      * DelegationPermissions.
    211      */
    212     @Override
    213     public PermissionCollection newPermissionCollection() {
    214         return new KrbDelegationPermissionCollection();
    215     }
    216
    217     /**
    218      * WriteObject is called to save the state of the DelegationPermission
    219      * to a stream. The actions are serialized, and the superclass
    220      * takes care of the name.

    221      */
    222     private synchronized void writeObject(java.io.ObjectOutputStream s)
    223         throws IOException
    224     {
    225         s.defaultWriteObject();
    226     }
    227
    228     /**
    229      * readObject is called to restore the state of the
    230      * DelegationPermission from a stream.

    231      */
    232     private synchronized void readObject(java.io.ObjectInputStream s)
    233          throws IOException, ClassNotFoundException
    234     {
    235         // Read in the action, then initialize the rest
    236         s.defaultReadObject();
    237         init(getName());
    238     }
    239
    240 }
    241
    242
    243 final class KrbDelegationPermissionCollection extends PermissionCollection
    244     implements java.io.Serializable {
    245
    246     // Not serialized; see serialization section at end of class.
    247     private transient ConcurrentHashMap<Permission, Boolean> perms;
    248
    249     public KrbDelegationPermissionCollection() {
    250         perms = new ConcurrentHashMap<>();
      1 /*
      2  * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
      3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      4  *
      5  * This code is free software; you can redistribute it and/or modify it
      6  * under the terms of the GNU General Public License version 2 only, as
      7  * published by the Free Software Foundation.  Oracle designates this
      8  * particular file as subject to the "Classpath" exception as provided
      9  * by Oracle in the LICENSE file that accompanied this code.
     10  *
     11  * This code is distributed in the hope that it will be useful, but WITHOUT
     12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14  * version 2 for more details (a copy is included in the LICENSE file that
     15  * accompanied this code).
     16  *
     17  * You should have received a copy of the GNU General Public License version
     18  * 2 along with this work; if not, write to the Free Software Foundation,
     19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     20  *
     21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     22  * or visit www.oracle.com if you need additional information or have any
    201      * Returns a PermissionCollection object for storing
    202      * DelegationPermission objects.
    203      * <br>
    204      * DelegationPermission objects must be stored in a manner that
    205      * allows them to be inserted into the collection in any order, but
    206      * that also enables the PermissionCollection implies method to
    207      * be implemented in an efficient (and consistent) manner.
    208      *
    209      * @return a new PermissionCollection object suitable for storing
    210      * DelegationPermissions.
    211      */
    212     @Override
    213     public PermissionCollection newPermissionCollection() {
    214         return new KrbDelegationPermissionCollection();
    215     }
    216
    217     /**
    218      * WriteObject is called to save the state of the DelegationPermission
    219      * to a stream. The actions are serialized, and the superclass
    220      * takes care of the name.
    221      *
    222      * @param  s the {@code ObjectOutputStream} to which data is written
    223      * @throws IOException if an I/O error occurs
    224      */
    225     private synchronized void writeObject(java.io.ObjectOutputStream s)
    226         throws IOException
    227     {
    228         s.defaultWriteObject();
    229     }
    230
    231     /**
    232      * readObject is called to restore the state of the
    233      * DelegationPermission from a stream.
    234      *
    235      * @param  s the {@code ObjectInputStream} from which data is read
    236      * @throws IOException if an I/O error occurs
    237      * @throws ClassNotFoundException if a serialized class cannot be loaded
    238      */
    239     private synchronized void readObject(java.io.ObjectInputStream s)
    240          throws IOException, ClassNotFoundException
    241     {
    242         // Read in the action, then initialize the rest
    243         s.defaultReadObject();
    244         init(getName());
    245     }
    246
    247 }
    248
    249
    250 final class KrbDelegationPermissionCollection extends PermissionCollection
    251     implements java.io.Serializable {
    252
    253     // Not serialized; see serialization section at end of class.
    254     private transient ConcurrentHashMap<Permission, Boolean> perms;
    255
    256     public KrbDelegationPermissionCollection() {
    257         perms = new ConcurrentHashMap<>();

< prev index next >