Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts

Thursday, September 12, 2013

Siriproxy - XFinity Remote Plugin

Hi everybody,

Just for fun!! I just created a plugin for Siriproxy to control your XFinity TV. If you can change channels with the XFinity Remote TV App : XFinity App on ITunes, you can use my plugin. Cool!

I discovered that the application use web services to change channels. With a little bit of reverse engineering, I able to create this plugin.

How it's work

  1. Log in to XFinity Web Server
  2. GET Profil Informations 
    1. Profil Token
    2. Device Key
  3. GET a token to change channels
  4. POST the channel

Install XFinityRemote plugin

First of all, you need to install Siriproxy on Linux, MAC OS, Windows or Raspberry Pi.
If it's already done, just follow the Siriproxy's tutorial on this website : https://github.com/plamoni/SiriProxy

Add the plugin

After that install my plugin it's available on my GitHub repository : https://github.com/fablanglet/SiriProxy-XFinityRemote


To configure XFinityRemote plugin, it's very simple.You just need to add your Comcast Login/Password. It's required to connect to the web server.
  1. Login
  2. Password

In the config.xml file, available in ~/.siriproxy/ folder, add this configuration :

  - name: 'XFinityRemote'
    git: 'github.com/fablanglet/SiriProxy-XFinityRemote.git'
    login: 'XfinityLogin'
    password: 'XFinityPassword'
 Don't forget to launch this command :  rvmsudo siriproxy bundle 

How to use

With my XfinityRemote plugin, you can change channels with the channel number or with the channel name. It's available for Siri in English and in French :) 
 Just say to Siri  : 'Channel number [Number]' or 'Channel [Name]' 

Demo

Thursday, December 13, 2012

ASP.NET Forms Authentication Safari/Chrome sur IOS

Contexte

Je développe actuellement une Webapp HTML5 communiquant avec des services WCF. Pour les sécuriser, j'ai implémenté l'authentification ASP.NET par formulaire.
Certaines fois, sur iOS 6,  l'appel au webservice sécurisé était refusé. Sur ipad, je l'ai généralement rencontré en Webview, quand on ajoute la webapp sur le Homescreen.

Lors de la connexion de l'utilisateur à la Web App, on réalise le code ci-dessous :
  1. FormsAuthentication.SetAuthCookie(userName, true /*createPersistentCookie*/);
La configuration de Web.config est la suivante :
  1. <authentication mode="Forms" >
  2. <forms loginUrl="../Login.html" timeout="2880" />
  3. </authentication>

Solution

En analysant la réponse du serveur je me suis aperçu que finalement je n'étais pas authentifié. Alors que le web service d'authentification l'avait bien confirmé.
Certaines fois le cookie d'authentification n'est pas bien obtenu par le navigateur, notamment sur Safari et Chrome. Après beaucoup de recherches, j'ai finalement trouvé une solution.

Plusieurs étapes sont à réaliser :
  1. Dans le Web.config, il faut ajouter la clé suivante, qui permet de forcer l'utilisation des cookies par le navigateur. Par défaut c'est UseDefault :
    1. <authentication mode="Forms" >
    2.        <forms loginUrl="../Login.html" timeout="2880" cookieless="UseCookies" />
    3. </authentication>
  2. Ensuite il peut aussi être utile de rajouter une MachineKey dans le Web.Config, pour éviter un problème dans le cryptage/décryptage du cookie d'authentification.
    1. <system.web> 
    2.       <machineKey validationKey='myKey' decryptionKey='myDecryptKey' validation='SHA1'/>
    3. </system.web>
Pour générer une machineKey, vous pouvez aller directement sur ce site : Générateur de machineKey