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
ConstructorsConstructorDescriptionAuthenticationHandler(SecurityConfig pSecurityConfig, String pAllowedOrigins) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext pContext, Object pRequest) private StringgetClientIp(io.netty.channel.ChannelHandlerContext pContext) private booleanisAllowedOriginHeader(io.netty.handler.codec.http.HttpRequest pRequest) booleanisValidApiKey(String pApiKey) private @Nullable StringparseTokenInAuthorizationHeader(io.netty.handler.codec.http.HttpRequest pRequest) private @Nullable StringparseTokenInSecWebsocketProtocolHeader(io.netty.handler.codec.http.HttpRequest pRequest) performSecurityChecks(io.netty.handler.codec.http.HttpRequest pRequest) private voidsendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext pContext, String pMessage) voidwrite(io.netty.channel.ChannelHandlerContext pContext, Object pMessage, io.netty.channel.ChannelPromise pPromise) 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 pContext, Object pRequest) 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 pContext, Object pMessage, io.netty.channel.ChannelPromise pPromise) 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 pRequest) -
isAllowedOriginHeader
private boolean isAllowedOriginHeader(io.netty.handler.codec.http.HttpRequest pRequest) -
parseTokenInAuthorizationHeader
private @Nullable String parseTokenInAuthorizationHeader(io.netty.handler.codec.http.HttpRequest pRequest) -
parseTokenInSecWebsocketProtocolHeader
private @Nullable String parseTokenInSecWebsocketProtocolHeader(io.netty.handler.codec.http.HttpRequest pRequest) -
isValidApiKey
-
getClientIp
-
sendUnauthorizedResponse
private void sendUnauthorizedResponse(io.netty.channel.ChannelHandlerContext pContext, String pMessage)
-