Class AuthenticationHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
net.minecraft.server.jsonrpc.security.AuthenticationHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
@Sharable
public class AuthenticationHandler
extends io.netty.channel.ChannelDuplexHandler
-
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext context, Object request) private StringgetClientIp(io.netty.channel.ChannelHandlerContext context) private booleanisAllowedOriginHeader(io.netty.handler.codec.http.HttpRequest request) booleanisValidApiKey(String apiKey) private @Nullable StringparseTokenInAuthorizationHeader(io.netty.handler.codec.http.HttpRequest request) private @Nullable StringparseTokenInSecWebsocketProtocolHeader(io.netty.handler.codec.http.HttpRequest request) performSecurityChecks(io.netty.handler.codec.http.HttpRequest request) private voidsendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext context, String message) voidwrite(io.netty.channel.ChannelHandlerContext context, Object message, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, readMethods 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
-
ATTR_WEBSOCKET_ALLOWED
-
SUBPROTOCOL_VALUE
- See Also:
-
SUBPROTOCOL_HEADER_PREFIX
- See Also:
-
BEARER_PREFIX
- See Also:
-
securityConfig
-
allowedOrigins
-
-
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
-
write
public void write(io.netty.channel.ChannelHandlerContext context, Object message, io.netty.channel.ChannelPromise promise) throws Exception - Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
writein classio.netty.channel.ChannelDuplexHandler- Throws:
Exception
-
performSecurityChecks
private AuthenticationHandler.SecurityCheckResult performSecurityChecks(io.netty.handler.codec.http.HttpRequest request) -
isAllowedOriginHeader
private boolean isAllowedOriginHeader(io.netty.handler.codec.http.HttpRequest request) -
parseTokenInAuthorizationHeader
private @Nullable String parseTokenInAuthorizationHeader(io.netty.handler.codec.http.HttpRequest request) -
parseTokenInSecWebsocketProtocolHeader
private @Nullable String parseTokenInSecWebsocketProtocolHeader(io.netty.handler.codec.http.HttpRequest request) -
isValidApiKey
-
getClientIp
-
sendUnauthorizedResponse
private void sendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext context, String message)
-