Class McpProtectionFilterHeaplet

java.lang.Object
org.forgerock.openig.heap.GenericHeaplet
org.forgerock.openig.mcp.McpProtectionFilterHeaplet
All Implemented Interfaces:
Heaplet

public class McpProtectionFilterHeaplet extends GenericHeaplet
Heaplet protecting an MCP server as an OAuth 2.0 Protected Resource, according to the MCP specification. This filter wraps an OAuth2ResourceServerFilter and adds the following features:
  • The registration of a static MCP OAuth 2.0 Protected Resource Metadata at the /.well-known/oauth-protected-resource URL
  • The adaptation of the potential WWW-Authenticate response header to include a resource_metadata directive
  • The validation of the resource claim in the OAuth2 Access Token
 {
   "type": "McpProtectionFilter",
   "config": {
     "resourceId":              String  [REQUIRED - the resource ID to return.]
     "authorizationServerUri":  URI     [REQUIRED - the Authorization Server URL to contact for access tokens.]
     "resourceServerFilter":    Filter  [REQUIRED - the OAuth2ResourceServerFilter instance to validate access
                                                    tokens.]
     "supportedScopes":         String[][OPTIONAL - The list of supported scopes to return in the resource metadata.
                                                    Defaults to none.]
     "realm":                   String  [OPTIONAL - specifies the name of the realm used in the authentication
                                                    challenges returned back to the client in case of errors.
                                                    Defaults to no realm.]
     "resourceIdPointer":       String [OPTIONAL - the JSON Pointer path to the resource ID claim in the access token.
                                                   Defaults to "/aud".]
     "wellKnownFilter":         Filter  [OPTIONAL - Filter to apply to requests targeting the well-known endpoint
                                                    (e.g. a CorsFilter to allow browser preflight requests).
                                                    Defaults to none. A warning is logged at startup when absent.]
   }
 }
 
See Also:
  • Constructor Details

    • McpProtectionFilterHeaplet

      public McpProtectionFilterHeaplet()
  • Method Details

    • create

      public Object create() throws HeapException
      Description copied from class: GenericHeaplet
      Called to request the heaplet create an object. Called by Heaplet.create(Name, JsonValue, Heap) after initializing the protected field members. Implementations should parse configuration but not acquire resources, start threads, or log any initialization messages. These tasks should be performed by the GenericHeaplet.start() method.
      Specified by:
      create in class GenericHeaplet
      Returns:
      The created object.
      Throws:
      HeapException - if an exception occurred during creation of the heap object or any of its dependencies.
    • destroy

      public void destroy()
      Description copied from interface: Heaplet
      Called to indicate that the object created by the heaplet is going to be dereferenced. This gives the heaplet an opportunity to free any resources that are being held prior to its dereference.
      Specified by:
      destroy in interface Heaplet
      Overrides:
      destroy in class GenericHeaplet