Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.security.jacc;
import java.security.SecurityPermission;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* This utility class is used by containers to communicate policy context identifiers and other policy relevant context
* to Policy providers. Policy providers use the policy context identifier to select the
* subset of policy to apply in access decisions.
*
*
* The value of a policy context identifier is a
* String and each thread has an independently established policy context identifier. A container will establish
* the thread-scoped value of a policy context identifier by calling the static setContextID method. The
* value of a thread-scoped policy context identifier is available (to Policy) by calling the static
* getContextID method.
*
*
* This class is also used by Policy providers to request additional thread-scoped policy relevant context
* objects from the calling container. Containers register container-specific PolicyContext handlers using
* the static registerHandler method. Handler registration is scoped to the class, such that the same
* handler registrations are active in all thread contexts. Containers may use the static method
* setHandlerData to establish a thread-scoped parameter that will be passed to handlers when they are
* activated by Policy providers. The static getContext method is used to activate a handler
* and obtain the corresponding context object.
*
*
* The static accessor functions provided by this class allow per-thread policy context values to be established and
* communicated independent of a common reference to a particular PolicyContext instance.
*
*
* The PolicyContext class may encapsulate static ThreadLocal instance variables to represent the policy context
* identifier and handler data values.
*
*
* The Application server must bundle or install the PolicyContext class, and the containers of the application server
* must prevent the methods of the PolicyContext class from being called from calling contexts that are not authorized
* to call these methods. With the exception of the getContextID and GetHandlerKeys methods, containers must restrict
* and afford access to the methods of the PolicyContext class to calling contexts trusted by the container to perform
* container access decisions. The PolicyContext class may satisfy this requirement (on behalf of its container) by
* rejecting calls made from an AccessControlContext that has not been granted the "setPolicy" SecurityPermission, and
* by ensuring that Policy providers used to perform container access decisions are granted the "setPolicy" permission.
*
* @see PolicyContextHandler
*
* @author Ron Monzillo
* @author Gary Ellison
*/
public final class PolicyContext {
private PolicyContext() {
}
/**
* This static instance variable contains the policy context identifier value. It's initial value is null.
*/
private static ThreadLocal threadLocalContextID = new ThreadLocal();
/**
* This static instance variable contains the handler parameter data object. It's initial value is null.
*/
private static ThreadLocal