New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accept or reject an user at server side #20
Comments
Here is the link to the |
Sorry, I do not understand how it would help me. ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(opCode, NettyUtils.writeStrings(refKey, userId, accessToken, firstName, lastName)); On LOG_IN attempt I send 5 parameters to the server. Server has to parse this message and accept or reject the client. Now reject is not possible since the server always accepts every client. And LOG_IN handler is implemented inside the library. |
Sorry for closing issue, tried to reopen it and could not...:( I will look into and answer. |
The LoginHandler has the following code public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel) { Credentials credentials = new SimpleCredentials(buffer); Player player = lookupService.playerLookup(credentials); if(null == player){ LOG.error("Invalid credentials provided by user: {}",credentials); } return player; } public void handleLogin(Player player,Channel channel) { if (null != player) { channel.write(NettyUtils .createBufferForOpcode(Events.LOG_IN_SUCCESS)); } else { // Write future and close channel closeChannelWithLoginFailure(channel); } } So if you return a null from the lookup service its going to invalidate the player and close the connection. In the ZombieSpringConfig class you can see the |
This is the message I have written before you last comment but did not post solving some other issue. "No problem, you help me a lot! I guess these lines of code are important to this task from LoginHandler.java public Player lookupPlayer(final ChannelBuffer buffer, final Channel channel)
{
Credentials credentials = new SimpleCredentials(buffer);
Player player = lookupService.playerLookup(credentials); I need to override lookupService.playerLookup to return null if authorization fails. BUT, I think it is much better to have this function so I will be able to parse ChannelBuffer by myself and not being stuck to SimpleCredentials." |
So my advice is to add following method My application would be authenticated with social network and client would submit 3 parameters to the server.
Of course, I can combine 1) and 2) in one String and then parse it to make it work with currently library build. |
Credentials ,interface was very simplistic hence you are running into this problem. Passing ChannelBuffer to a service is not a great idea, first of all it leaks and second the new netty version |
Yes, this makes sense. |
In here why player is not used to create a playerSession? public void handleGameRoomJoin(Player player, Channel channel, ChannelBuffer buffer)
{
String refKey = NettyUtils.readString(buffer);
GameRoom gameRoom = lookupService.gameRoomLookup(refKey);
if(null != gameRoom)
{
PlayerSession playerSession = gameRoom.createPlayerSession(); |
I have added an issue for this. I will update and provide code. |
I have committed the change for this. Binaries are NOT updated, please build and use latest jetserver jar file. |
I have imported the jetserver folder to Eclipse. And these are two major types of errors I am getting. Description Resource Path Location Type
ArtifactDescriptorException: Failed to read artifact descriptor for cglib:cglib-nodep:jar:2.1_3: ArtifactResolutionException: Failure to transfer cglib:cglib-nodep:pom:2.1_3 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact cglib:cglib-nodep:pom:2.1_3 from/to central (http://repo1.maven.org/maven2): Connect times out pom.xml /jetserver line 1 Maven Dependency Problem Description Resource Path Location Type
Project 'jetserver' is missing required library: 'C:\Users\Nikolay\.m2\repository\backport-util-concurrent\backport-util-concurrent\3.1\backport-util-concurrent-3.1.jar' jetserver Build path Build Path Problem |
Hello again,
I am back to implement authentication of client at server.
At client side I use this code
Where userId, accessToken, firstName and lastName come from Facebook authentication of the client. So then client provides this data to server who will check validity of the data and then accept or the reject the user.
The problem is that at server side I see LOG_IN event only inside compiled library jetserver-0.1.jar.
So how am I supposed to implement this kind of feature without touching the library?
The text was updated successfully, but these errors were encountered: