Class McpBearerAuthenticationEntryPoint

java.lang.Object
com.xebialabs.xldeploy.authentication.oidc.McpBearerAuthenticationEntryPoint
All Implemented Interfaces:
org.springframework.security.web.AuthenticationEntryPoint

public final class McpBearerAuthenticationEntryPoint extends Object implements org.springframework.security.web.AuthenticationEntryPoint
Challenge for a bearer token that was presented and rejected, and for an unauthenticated request when the resource-server filter answers it. On the MCP endpoint, while OAuth discovery is active, it is the framework's own bearer challenge with the protected-resource metadata URL, so a client can tell "no token" (hint only) from "bad token" (hint plus an error code) and knows where to start the OAuth flow.

The framework copies the exception's description into the header. For a JWT failure that text can carry decoder detail (expiry times, claim names, parser messages), so any OAuth2 error is replaced by a fixed one before the framework formats it. Everything outside the MCP endpoint, and every request while discovery is not active, keeps the plain framework challenge exactly as before.

  • Constructor Details

    • McpBearerAuthenticationEntryPoint

      public McpBearerAuthenticationEntryPoint(Supplier<Optional<String>> metadataUrl)
  • Method Details

    • commence

      public void commence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException authenticationException) throws IOException, jakarta.servlet.ServletException
      Specified by:
      commence in interface org.springframework.security.web.AuthenticationEntryPoint
      Throws:
      IOException
      jakarta.servlet.ServletException