Record Class TokenAccessProfile

java.lang.Object
java.lang.Record
eu.mrapik.minecraftservermcp.config.TokenAccessProfile
Record Components:
profileName - display name for this access.* block
token - secret matched against HTTP headers
tools - per-tool-id policies under tools

public record TokenAccessProfile(String profileName, String token, Map<String,ToolAccessConfig> tools) extends Record
One named entry under access in config.yml: a shared secret token and a map of ToolAccessConfig keyed by MCP tool id.

The profile name is informational (logging, debugging). The token string is matched against the value extracted from the HTTP request (see HttpTokenSupport).

  • Constructor Details

  • Method Details

    • profileName

      public String profileName()
      Config section name, e.g. admin.
      Returns:
      profile key from config
    • token

      public String token()
      Secret value clients must present; must match exactly (including no extra whitespace after trim in the HTTP layer).
      Returns:
      raw token string
    • toolConfig

      @NotNull public @NotNull ToolAccessConfig toolConfig(String toolId)
      Returns the policy for toolId, or ToolAccessConfig.permissiveDefault() if the profile defines no tools.&lt;toolId&gt; block.
      Parameters:
      toolId - MCP tool name (same as McpToolDefinition.id())
      Returns:
      effective tool policy
    • tools

      public Map<String,ToolAccessConfig> tools()
      Unmodifiable view of all configured tool sections for this profile.
      Returns:
      map from tool id to policy
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.