<fim-prefix>and
 *  limitations under the License.
 */

import javax.management.ObjectName;

import org.jolokia.util.HttpMethod;
import org.jolokia.util.RequestType;

/**
 * Base restrictor which alway returns the constant given
 * at construction time
 *
 * @author roland
 * @since 06.10.11
 */
public abstract class AbstractConstantRestrictor implements Restrictor {

    private boolean isAllowed;

    /**
     * Create restrictor which always returns the given value on every check
     * method.
     *
     * @param pAllowed whether access is allowed or denied
     */
    protected AbstractConstantRestrictor(boolean pAllowed) {
        isAllowed = pAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isHttpMethodAllowed(HttpMethod pMethod) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isTypeAllowed(RequestType pType) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isAttributeReadAllowed(ObjectName pName, String pAttribute) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isAttributeWriteAllowed(ObjectName pName, String pAttribute) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isOperationAllowed(ObjectName pName, String pOperation) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    public final boolean isRemoteAccessAllowed(String... pHostOrAddress) {
        return isAllowed;
    }

    /** {@inheritDoc} */
    // BUG: CWE-352 Cross-Site Request Forgery (CSRF)
    // public boolean isCorsAccessAllowed(String pOrigin) {
    // FIXED: 
<fim-middle>    public boolean isOriginAllowed(String pOrigin, boolean pIsStrictCheck) {
        return isAllowed;
    }
}
<fix-suffix><|endoftext|>