예제 #1
0
        private string GetAuthHeader(Account account, Session session)
        {
            string date = DateTime.Now.ToString("R");

            string input = string.Format("{0}:{1}:P:{2}:DK:{3}:{4}",
                account.ActivationCode,
                session.DeviceId,
                account.UserId,
                account.Password,
                date);

            string challenge = Sha256Hash(input);
            challenge = Sha256Hash(challenge);

            return string.Format("logon deviceid=\"{0}\",datetime=\"{1}\",challenge=\"{2}\"", session.DeviceId, date, challenge);
        }
예제 #2
0
 public void GetFolderId(Session session, string folderId)
 {
 }
예제 #3
0
 public void GetFileDataForMessageId(Session session, string messageId)
 {
 }
예제 #4
0
        public Session GetSessionForAccount(Account account)
        {
            RestClient client = new RestClient(BaseUrl);
            client.UserAgent = "eboks/35 CFNetwork/672.1.15 Darwin/14.0.0";

            var request = new RestRequest("/session", Method.PUT);
            request.RequestFormat = DataFormat.Xml;

            Session session = new Session();
            session.DeviceId = Guid.NewGuid().ToString();

            request.AddHeader("X-EBOKS-AUTHENTICATE", GetAuthHeader(account, session));
            //request.AddHeader("Content-Type", "application/xml");
            request.AddHeader("Accept", "*/*");

            var logon = new Logon();
            logon.App = new App();
            logon.App.Version = "1.4.1";
            logon.App.OS = "iOS";
            logon.App.OSVersion = "9.0.0";
            logon.App.Device = "iPhone";

            logon.User = new User();
            logon.User.Identity = account.UserId;
            logon.User.IdentityType = "P";
            logon.User.Nationality = "DK";
            logon.User.Pincode = account.Password;

            //request.AddBody(logon, "urn:eboks:mobile:1.0.0");

            /*
string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + Environment.NewLine +
             "<register-request">" + Environment.NewLine +
             "    <name=\"someName\"/>" + Environment.NewLine +
             "</register-request>");

request.AddParameter("text/xml", registerSinkRequest, ParameterType.RequestBody);
            */

            string xml;

            var serializer = new XmlSerializer(logon.GetType(), "urn:eboks:mobile:1.0.0");

            var ns = new XmlSerializerNamespaces();
            ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
            ns.Add("xsd", "http://www.w3.org/2001/XMLSchema");

            using(StringWriter textWriter = new Utf8StringWriter())
            {
                serializer.Serialize(textWriter, logon, ns);
                xml = textWriter.ToString();
            }




            IRestResponse response;

            response = client.Execute(request);

            return null;
        }