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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classNested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate static final io.netty.util.AttributeKey<Boolean> static final Stringprivate final org.slf4j.Loggerprivate final SecurityConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext context, Object request) private StringgetClientIp(io.netty.channel.ChannelHandlerContext context) booleanisValidApiKey(String apiKey) performSecurityChecks(io.netty.handler.codec.http.HttpRequest request) private voidsendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext context, String message) private booleanvalidateAuthentication(io.netty.handler.codec.http.HttpRequest request) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
LOGGER
private final org.slf4j.Logger LOGGER -
AUTHENTICATED_KEY
-
AUTH_HEADER
- See Also:
-
BEARER_PREFIX
- See Also:
-
securityConfig
-
-
Constructor Details
-
AuthenticationHandler
-
-
Method Details
-
channelRead
public void channelRead(io.netty.channel.ChannelHandlerContext context, Object request) throws Exception - Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
performSecurityChecks
private AuthenticationHandler.SecurityCheckResult performSecurityChecks(io.netty.handler.codec.http.HttpRequest request) -
validateAuthentication
private boolean validateAuthentication(io.netty.handler.codec.http.HttpRequest request) -
isValidApiKey
-
getClientIp
-
sendUnauthorizedResponse
private void sendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext context, String message)
-