[Authentication]
#1
Information 
hello there;
can anyone tell me how works this function on the server side? how mcserver handle answer from auth-server? please, take me more information, cause I'm not very strong in c++
Reply
Thanks given by:
#2
Authentication is described in the protocol wiki:
http://wiki.vg/Authentication#Server_operation

As for MCServer, it does exactly as written there. It receives the 0x02 handshake packet (cSocketThreads does the actual receiving, it sends data through cClientHandle into cProtocolRecognizer, that one recognizes the protocol and sends the packet into cProtocol142, which decodes the packet's meaning and calls cClientHandle's HandleHandshake and then HandleLogin (for historical reasons; earlier protocols had separate Login packets which triggerred the auth mechanism)). The HandleLogin function queues an auth-checking request with cAuthenticator.
The cAuthenticator is probably the object that you want to see the most. It runs a separate thread that processes each auth-checking request asynchronously. For each incoming request, it calls AuthFromAddress(), which connects to the auth server, sends the request and receives the answer using HTTP. If it receives a redirect request, it reconnects to the new URL and re-tries.
If successful, it sends an "auth ok" signal to the cClientHandle, through cRoot's AuthenticateUser. If not successfull, it kicks the user.

Is that good enough an explanation? Smile
Reply
Thanks given by: SashaSansay
#3
Yes Smile Thanls a lot!
Reply
Thanks given by:
#4
It's all so cool, but I don't understand, why server kicks me with DC "Bad Login", when auth in launcher is okay and all other Information is okay

This is checkserver.php
PHP Code:
<?php
define
('INCLUDE_CHECK',true);
include (
"connect.php");

$user mysql_real_escape_string($_GET['user']);
$serverid mysql_real_escape_string($_GET['serverId']);

$result mysql_query("Select $db_columnUser From $db_table Where $db_columnUser='$user'") or die ("Запрос к базе завершился ошибкой.");

if(
mysql_num_rows($result) == 1){
    echo 
"YES";
} else{
    echo 
"NO";
}

?>

and this is setting.ini
PHP Code:
[Authentication]
Server=http://tramway.in
Address=/auth/checkserver.php?user=%USERNAME
; &
serverId=%SERVERID%
Authenticate=

in MySQL Charset is UTF-8

UPD:
Also It doesn't works if
PHP Code:
<?php
define
('INCLUDE_CHECK',true);
include (
"connect.php");

$user mysql_real_escape_string($_GET['user']);
$serverid mysql_real_escape_string($_GET['serverId']);

$result mysql_query("Select $db_columnUser From $db_table Where $db_columnUser='$user'") or die ("Запрос к базе завершился ошибкой.");

if(
mysql_num_rows($result) == 1){
    echo 
"YES";
} else{
   echo 
"YES";
}

?>
Reply
Thanks given by:
#5
Isn't a bad login on the client side? That's not the server kicking you, that's the client refusing to connect.
Reply
Thanks given by:
#6
(11-22-2012, 11:09 AM)FakeTruth Wrote: Isn't a bad login on the client side? That's not the server kicking you, that's the client refusing to connect.

hm.. may be.. have you any ideas how can I fix it? or why client refus to connect?
Reply
Thanks given by:
#7
Are you using a valid login?
Reply
Thanks given by:
#8
(11-22-2012, 10:44 PM)FakeTruth Wrote: Are you using a valid login?

yep

UPD:
And one more question:
what file does replaces this ? "NetClientHandler.java"
Reply
Thanks given by:
#9
It seems to me it fails at step 5 of the client operations http://wiki.vg/Authentication#Server_operation
Quote:5. Client sends a HTTP request to
http://session.minecraft.net/game/joinse...d=<session id>&serverId=<server hash>
If the response is OK then continue, otherwise stop

Apparently response is not OK, so the client stops
Reply
Thanks given by:
#10
(11-23-2012, 01:39 AM)FakeTruth Wrote: It seems to me it fails at step 5 of the client operations http://wiki.vg/Authentication#Server_operation
Quote:5. Client sends a HTTP request to
http://session.minecraft.net/game/joinse...d=<session id>&serverId=<server hash>
If the response is OK then continue, otherwise stop

Apparently response is not OK, so the client stops


I think that's right. And to change the joinserver URL we need the analog of NetClientHandler.java. the file NetClientHandler.java of vanilla server. contains link to joinserver.jsp.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)