<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 9, 2013 at 5:53 PM, Matthias Wessendorf <span dir="ltr"><<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Apr 9, 2013 at 4:47 PM, Matthias Wessendorf <span dir="ltr"><<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:15px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:0px!important">
Hi,</p>
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">as you know the unified push server has a 'registration' component (see <a href="https://gist.github.com/matzew/69d33a18d4fac9fdedd4" style="color:rgb(65,131,196);text-decoration:none" target="_blank">here</a> for details; see <a href="https://gist.github.com/matzew/2da6fc349a4aaf629bce" style="color:rgb(65,131,196);text-decoration:none" target="_blank">here</a> for REST APIs) which does the following:</p>
<ul style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px"><li>app registration and adding multiple variations</li>
<li>registration of an installation, submitted from the device</li></ul><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">There are different roles (as also discussed in the above links).... The "app registration" functionality can be only achieved by something <em>like</em> an "admin";</p>
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The admin can create a logical app construct on the server ( <em>Sport News mobile</em> ), which has different variations:</p>
<ul style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px"><li>free for iOS/Android (no user required, everybody can install the app)</li>
<li>paid (same, for both: iOS/Android): User is required, since they pay for extra, exclusive content</li></ul><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">
Now.... the "logical" app construct on the server get's some ID, when the app has been registered... (similar for each of the variants: iOS/iOS-paid etc...)</p><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">
This part of the registration needs to be protected, very well (e.g. OAuth); just thinking out loud.... But yeah... only users, with the proper rights should be able to register (update/delete) apps here!!!</p><h3 style="font-size:18px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:20px 0px 10px;padding:0px">
<a name="13def80d33a77011_13def446e1769376_deviceinstallation-registration" href="https://gist.github.com/matzew/e335881b3f95b1448774#deviceinstallation-registration" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"></a>Device/Installation registration</h3>
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:0px 0px 15px">However, the other part of the registration (when an installation, from a device, tries to register itself for wanting to receive messages), may be a little more "weak"...</p>
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">Scenario:</p><ul style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px">
<li>Someone downloads the free iOS app:</li><li>once he launches the app and he agrees on receiving push messages</li><li>Now... the app should send the generated token (generated by the actual Push Network), to the registration server... (otherwise it can't receive push messages :-) ).</li>
</ul><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">So...... the following information needs to be available.... so that the mobile dev. for the free iOS app can register the token with the server:</p>
<ul style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px"><li>APP ID (+ mobile-variant ID)</li></ul><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">
Yes, the IDs are needed.... in order to tell the "registration server": <em>Hey, this installation for XYZ wants to receive messages.....</em></p><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">
So, the iOS (client SDK) code could look like:</p><div style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="font-weight:bold">-</span> <span>(</span><span style="color:rgb(68,85,136);font-weight:bold">void</span><span>)</span><span style="color:rgb(153,0,0);font-weight:bold">application:</span><span>(</span><span style="color:rgb(51,51,51)">UIApplication</span> <span style="font-weight:bold">*</span><span>)</span><span style="color:teal">application</span>
<span>didRegisterForRemoteNotificationsWithDeviceToken:</span><span>(</span><span style="color:rgb(51,51,51)">NSData</span> <span style="font-weight:bold">*</span><span>)</span><span style="color:teal">deviceToken</span>
<span>{</span>
<span style="color:rgb(51,51,51)">NSURL</span> <span style="font-weight:bold">*</span><span style="color:rgb(51,51,51)">serverURL</span> <span style="font-weight:bold">=</span> <span>[</span><span style="color:rgb(51,51,51)">NSURL</span> <span style="color:rgb(51,51,51)">URLWithString</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">@"<a href="http://pusher.server.com/registry/device/" target="_blank">http://pusher.server.com/registry/device/</a>"</span><span>];</span>
<span style="color:rgb(51,51,51)">PushClient</span> <span style="font-weight:bold">*</span><span style="color:rgb(51,51,51)">pclient</span> <span style="font-weight:bold">=</span> <span>[</span><span style="color:rgb(51,51,51)">PushClient</span> <span style="color:rgb(51,51,51)">appID</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">@"1234"</span> <span style="color:rgb(51,51,51)">mobileID</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">@"456454"</span><span>];</span>
<span>[</span><span style="color:rgb(51,51,51)">pclient</span> <span style="color:rgb(51,51,51)">registerDeviceToken</span><span style="font-weight:bold">:</span><span style="color:rgb(51,51,51)">deviceToken</span> <span style="color:rgb(51,51,51)">withServer</span><span style="font-weight:bold">:</span><span style="color:rgb(51,51,51)">serverURL</span> <span style="color:rgb(51,51,51)">success</span><span style="font-weight:bold">:^</span><span>(</span><span style="color:rgb(68,85,136);font-weight:bold">id</span> <span style="color:rgb(51,51,51)">responseObject</span><span>)</span> <span>{</span>
<span style="color:rgb(51,51,51)">NSLog</span><span>(</span><span style="color:rgb(221,17,68)">@"Registration Success: %@"</span><span>,</span> <span style="color:rgb(51,51,51)">responseObject</span><span>);</span>
<span>}</span> <span style="color:rgb(51,51,51)">failure</span><span style="font-weight:bold">:^</span><span>(</span><span style="color:rgb(51,51,51)">NSError</span> <span style="font-weight:bold">*</span><span style="color:rgb(51,51,51)">error</span><span>)</span> <span>{</span>
<span style="color:rgb(51,51,51)">NSLog</span><span>(</span><span style="color:rgb(221,17,68)">@"Registration Error: %@"</span><span>,</span> <span style="color:rgb(51,51,51)">error</span><span>);</span>
<span>}];</span>
<span>}</span>
</pre></div><p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The code above would be used by some customer/user, when they register their app with their running version, of our Unified Push server..... Not sure.... are we concerned about the keys are compiled into the actual app, that everybody could download from the app store ?</p>
</div></blockquote><div><br></div><div><br></div></div></div><div>Others do similar, requiring some sort of "API KEY" (similar to our appID/MobileID pair) being submitted when registering a specific device/installation. </div>
<div><br></div><div>That said, without these IDs/Keys.... you can't register an app... </div></div></div></div></blockquote><div><br></div><div><br></div><div style>perhaps this app/mobile app thing can be used + a "private key" (e.g. for the admin/developer....) and internally we issue some OAuth req., for the registration?</div>
<div style><br></div><div style><br></div><div style>I guess.... we should do/recommend some sort of encryption here.... since these keys are compiled into the app.......</div><div style><br></div><div style>hrm...</div><div>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>NOTE: the appID/mobileID keys are generated by our server, when an admin/developer creates the logical construct of an app, on the server...</div>
<div class="im">
<div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<p style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">We really can't issue a login in the above case, since there may be no user..... and even if the paid app, requires a user..... someone can still first buy the app, and after installation decide to register a new user, from the app...... so the above code is still executed BEFORE the user decides to active/register his account...</p>
<span><font color="#888888">
<p style="line-height:20px;margin-right:0px;font-size:13.63636302947998px;margin-left:0px;margin-bottom:0px!important;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:15px">Matthias</p><div>
<br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</font></span></div>
</blockquote></div></div><div class="im"><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>