001/* 002 * Copyright 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet; 018 019import org.jspecify.annotations.NonNull; 020 021import javax.annotation.concurrent.ThreadSafe; 022 023/** 024 * Fresh HTTP admission and authorization for GET delivery and DELETE cleanup 025 * at session-enabled {@code 2025-06-18} and {@code 2025-11-25} endpoints. 026 * Soklet's {@code 2026-07-28} implementation does not use this controller. 027 * <p> 028 * Implementations must support concurrent invocation and evaluate current 029 * authority on every call, including reauthorization using the original GET 030 * request. The accepted identity is freshly owner-verified. GET permission 031 * alone does not grant permission to receive updates for any resource URI. 032 * <p> 033 * The features provide cooperative cancellation for deadlines, disconnect, 034 * reconciliation and shutdown. Progress reporting and task creation are 035 * unavailable. Keep callbacks bounded and respond promptly to cancellation; 036 * physical execution remains reserved until an uncooperative callback exits. 037 * 038 * @author <a href="https://www.revetkn.com">Mark Allen</a> 039 */ 040@ThreadSafe 041@FunctionalInterface 042public interface McpSessionTransportAdmissionController { 043 /** 044 * Evaluates current HTTP authority and returns a bounded authorization 045 * expiry or a safe HTTP rejection. 046 * 047 * @param sessionTransportAdmissionContext immutable HTTP operation context 048 * @param invocationFeatures features for this bounded callback 049 * @return accepted identity, expiry and selected families, or a rejection 050 * @throws Exception if application admission fails 051 */ 052 @NonNull 053 McpSessionTransportAdmissionDecision admit( 054 @NonNull McpSessionTransportAdmissionContext sessionTransportAdmissionContext, 055 @NonNull McpInvocationFeatures invocationFeatures) throws Exception; 056}