You are not logged in.
Pages: 1
How to mORMot authenication from android please sample to me
i found this
http://synopse.info/forum/viewtopic.php … 515#p12515
but i am not javascript expert , i can not convert to java
thank you.
Jongruk Aripoo
Offline
Unfortunatly, I couldn't find my native Android/mORMot project, I think my sneak nephew delete this project, I'll try to recover that project and post the full source, anyway, take a look at this source:
https://raw.githubusercontent.com/synop … tcode.java
Offline
i modify some code all work fine until this method
public String sessionSign(String url) {
long Tix;
Date d = new Date();
Tix = d.getTime();
if(lastSessionTickCount == Tix)
Tix += 1;
lastSessionTickCount = Tix;
String aNonce = Long.toHexString(Tix);
while(aNonce.length() < 8)
aNonce = '0' +aNonce;
if (aNonce.length() > 8)
aNonce = aNonce.substring(aNonce.length() - 8, aNonce.length());
String ss = Long.toHexString(getCRC32(url,
getCRC32(aNonce, sessionPrivateKey)));
while(ss.length() < 8) { ss = '0'+ss; }
String s = url.indexOf("?") == -1 ? url+ "?session_signature=" : url+ "&session_signature=";
System.out.println("## sessionIDHexa8="+sessionIDHexa8+" ,aNonce="+aNonce+" ,ss="+ss+" ,s="+s);
return s + sessionIDHexa8 + aNonce + ss;
}
i am not understand 2 variable (aNonce,ss) , the value of aNonce,ss not same javascript at below , sessionIDHexa8 is same as javascripts
Client.prototype.signUrl = function (url) {
if (Client._instance.loggedIn === true) {
var Tix, Nonce, s, ss, d = new Date();
Tix = d.getTime() - Client._instance.SessionTickCountOffset;
Nonce = Tix.toString(16);
while (Nonce.length < 8) {
Nonce = '0' + Nonce;
}
if (Nonce.length > 8) {
Nonce = Nonce.slice(Nonce.length - 8);
}
ss = Client._instance.crc32(url, Client._instance.crc32(Nonce, Client._instance.SessionPrivateKey)).toString(16);
while (ss.length < 8) {
ss = '0' + ss;
}
s = url.indexOf("?") === -1 ? url + '?session_signature=' : url + '&session_signature=';
console.log("SessionIDHexa8="+Client._instance.SessionIDHexa8+" , Nonce="+Nonce+" ,ss= "+ss+" ,s="+s);
return s + Client._instance.SessionIDHexa8 + Nonce + ss;
} else {
return url;
}
};
Jongruk Aripoo
Offline
Pages: 1