Class AuthenticationHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
net.minecraft.server.jsonrpc.security.AuthenticationHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

@Sharable public class AuthenticationHandler extends io.netty.channel.ChannelInboundHandlerAdapter
  • Field Details

    • LOGGER

      private final org.slf4j.Logger LOGGER
    • AUTHENTICATED_KEY

      private static final io.netty.util.AttributeKey<Boolean> AUTHENTICATED_KEY
    • AUTH_HEADER

      public static final String AUTH_HEADER
      See Also:
    • BEARER_PREFIX

      public static final String BEARER_PREFIX
      See Also:
    • securityConfig

      private final SecurityConfig securityConfig
  • Constructor Details

    • AuthenticationHandler

      public AuthenticationHandler(SecurityConfig pSecurityConfig)
  • Method Details

    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext pContext, Object pRequest) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • performSecurityChecks

      private AuthenticationHandler.SecurityCheckResult performSecurityChecks(io.netty.handler.codec.http.HttpRequest pRequest)
    • validateAuthentication

      private boolean validateAuthentication(io.netty.handler.codec.http.HttpRequest pRequest)
    • isValidApiKey

      public boolean isValidApiKey(String pApiKey)
    • getClientIp

      private String getClientIp(io.netty.channel.ChannelHandlerContext pContext)
    • sendUnauthorizedResponse

      private void sendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext pContext, String pMessage)