< prev index next >

src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java

Print this page
rev 53560 : 8218022: Repeated words typos in java.base
Reviewed-by: alanb, lancea
Contributed-by: Andrey Turbanov <turbanoff@gmail.com>
   1 /*
   2  * Copyright (c) 1999, 2018, 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


  40  *
  41  * @since 1.4
  42  */
  43 public class SubjectDomainCombiner implements java.security.DomainCombiner {
  44 
  45     private Subject subject;
  46     private WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs =
  47                 new WeakKeyValueMap<>();
  48     private Set<Principal> principalSet;
  49     private Principal[] principals;
  50 
  51     private static final sun.security.util.Debug debug =
  52         sun.security.util.Debug.getInstance("combiner",
  53                                         "\t[SubjectDomainCombiner]");
  54 
  55     /**
  56      * Associate the provided {@code Subject} with this
  57      * {@code SubjectDomainCombiner}.
  58      *
  59      * @param subject the {@code Subject} to be associated with
  60      *          with this {@code SubjectDomainCombiner}.
  61      */
  62     public SubjectDomainCombiner(Subject subject) {
  63         this.subject = subject;
  64 
  65         if (subject.isReadOnly()) {
  66             principalSet = subject.getPrincipals();
  67             principals = principalSet.toArray
  68                         (new Principal[principalSet.size()]);
  69         }
  70     }
  71 
  72     /**
  73      * Get the {@code Subject} associated with this
  74      * {@code SubjectDomainCombiner}.
  75      *
  76      * @return the {@code Subject} associated with this
  77      *          {@code SubjectDomainCombiner}, or {@code null}
  78      *          if no {@code Subject} is associated with this
  79      *          {@code SubjectDomainCombiner}.
  80      *


   1 /*
   2  * Copyright (c) 1999, 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


  40  *
  41  * @since 1.4
  42  */
  43 public class SubjectDomainCombiner implements java.security.DomainCombiner {
  44 
  45     private Subject subject;
  46     private WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs =
  47                 new WeakKeyValueMap<>();
  48     private Set<Principal> principalSet;
  49     private Principal[] principals;
  50 
  51     private static final sun.security.util.Debug debug =
  52         sun.security.util.Debug.getInstance("combiner",
  53                                         "\t[SubjectDomainCombiner]");
  54 
  55     /**
  56      * Associate the provided {@code Subject} with this
  57      * {@code SubjectDomainCombiner}.
  58      *
  59      * @param subject the {@code Subject} to be associated with
  60      *          this {@code SubjectDomainCombiner}.
  61      */
  62     public SubjectDomainCombiner(Subject subject) {
  63         this.subject = subject;
  64 
  65         if (subject.isReadOnly()) {
  66             principalSet = subject.getPrincipals();
  67             principals = principalSet.toArray
  68                         (new Principal[principalSet.size()]);
  69         }
  70     }
  71 
  72     /**
  73      * Get the {@code Subject} associated with this
  74      * {@code SubjectDomainCombiner}.
  75      *
  76      * @return the {@code Subject} associated with this
  77      *          {@code SubjectDomainCombiner}, or {@code null}
  78      *          if no {@code Subject} is associated with this
  79      *          {@code SubjectDomainCombiner}.
  80      *


< prev index next >