Package com.cloud.serverpak.handlers
Class AuthHandler
java.lang.Object
com.cloud.serverpak.handlers.AuthHandler
Class listener of messages carrying information about the authorization request.
Defines the method for user authorization on the server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthServiceAuthorization service.private final FilesInformServiceFile information service.private final MainHandlerNetty's main listener. -
Constructor Summary
ConstructorsConstructorDescriptionAuthHandler(MainHandler mainHandler) The constructor gets a reference to the main listener. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthHandle(io.netty.channel.ChannelHandlerContext ctx, Object msg) Performs user authorization on the server.
-
Field Details
-
mainHandler
Netty's main listener.- See Also:
-
authService
Authorization service.- See Also:
-
fileService
File information service.- See Also:
-
-
Constructor Details
-
AuthHandler
The constructor gets a reference to the main listener.- Parameters:
mainHandler- Netty's main listener.
-
-
Method Details
-
authHandle
Performs user authorization on the server. Requests the user authorization service with the login and password received in the message, if the user is, then sends a service message a messageAuthMessagewith the name of the authorized user and a list of files in the cloud for this user. Additionally sends the following messageFilesSizeRequestcarrying information about the storage status for this user.If registration is refused, it returns the same service message with Login "none", which indicates to the client that authorization has not been completed.- Parameters:
ctx- channel context.msg- the message object.- See Also:
-