<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 29, 2013 at 12:18 PM, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi, sorry for my n00bish. I like the idea of libraries to make<br>


developer&#39;s life easier, I just have few questions.<br>
<br>
Is possible to have both into AGAuthenticationModuleAdapter?<br>
NSURLCredential for developers pretty familiar with it (and wants full<br>
control)  and HTTPBasicDigestAuthenticationModule for developer who want<br>
to keep it simple?<br></blockquote><div><br></div><div>Interesting point. Let me think about it</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
Another question? Why not HTTPAuthenticationModule? With the addition of<br>
more auth schemes you will end with something like<br>
HTTPBasicDigestHawkPersonaOAuth2AuthenticationModule.<br></blockquote><div><br></div><div><br></div><div>oh, right :) yeah, let&#39;s name it AG<span style="font-family:arial,sans-serif;font-size:13px">HTTPAuthenticationModule.h/m. Good point</span></div>

<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><br>
<br>
<br>
Corinne Krych wrote:<br>
&gt; Thanks for the clarification.<br>
&gt; I think I didn&#39;t get it.<br>
&gt; Indeed it should be well documented  as you would expect a login action<br>
&gt; (ie doing an actual login on endpoint) when sending a login message.<br>
&gt; saveLoginCredentials would be the correct message but I guess we rather<br>
&gt; stick to AGAuthenticationModuleAdapter protocol.<br>
&gt;<br>
&gt; +1<br>
&gt; Corinne<br>
&gt;<br>
&gt;<br>
&gt; On 29 May 2013 11:13, Matthias Wessendorf &lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a><br>
</div><div>&gt; &lt;mailto:<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     On Wed, May 29, 2013 at 10:20 AM, Christos Vasilakis<br>
</div><div>&gt;     &lt;<a href="mailto:cvasilak@gmail.com" target="_blank">cvasilak@gmail.com</a> &lt;mailto:<a href="mailto:cvasilak@gmail.com" target="_blank">cvasilak@gmail.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;         Hi,<br>
&gt;<br>
&gt;         iOS platform provides built-in implementations for<br>
&gt;         authenticating against HTTP endpoints that support Basic /<br>
&gt;         Digest authentication (among others). The workflow when iOS<br>
&gt;         tries to authenticate against those endpoints is basically:<br>
&gt;<br>
&gt;         a) A credential storage singleton object<br>
</div>&gt;         &lt;<a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCredentialStorage_Class/Reference/Reference.html" target="_blank">https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCredentialStorage_Class/Reference/Reference.html</a>&gt; provided<br>


<div>&gt;         by the system is consulted for authentication credentials. If<br>
&gt;         credentials are found, the system proceeds with authentication.<br>
&gt;         Understandably for this to work, the developer has to initially<br>
&gt;         push the credentials to the system object (and remove when done).<br>
&gt;<br>
&gt;         b) If credentials are NOT found, the system tries to call the<br>
&gt;         delegate method e.g.<br>
&gt;         &#39;connection:didReceiveAuthenticationChallenge<br>
</div>&gt;         &lt;<a href="http://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSURLConnectionDelegate/connection:didReceiveAuthenticationChallenge" target="_blank">http://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSURLConnectionDelegate/connection:didReceiveAuthenticationChallenge</a>:&gt;&#39;,<br>


<div>&gt;         giving a chance for the user to provide the credentials, by<br>
&gt;         calling the appropriate methods on the authentication challenge<br>
&gt;         object passed in.<br>
&gt;<br>
&gt;         AeroGear library,  currently has a notion of pluggable<br>
&gt;         authentication modules providing an interface for clients to<br>
&gt;         implement &#39;login&#39;, and &#39;logout&#39; methods, depending on the<br>
&gt;         authentication scenarios that they try to support. This fits<br>
&gt;         nicely with singleton credential storage approach, in the sense<br>
&gt;         when doing &#39;login&#39; and &#39;logout&#39;, we simply edit the credential<br>
&gt;         storage adding or removing credentials appropriately. A branch<br>
&gt;         for this work can be found here<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios/tree/basic.digest.auth" target="_blank">https://github.com/cvasilak/aerogear-ios/tree/basic.digest.auth</a>&gt;.<br>
<div>&gt;         For usage, have a look at our integration test<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.auth/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m" target="_blank">https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.auth/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m</a>&gt;<br>


<div>&gt;<br>
&gt;         For testing purposes, another branch<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios/tree/basic.digest.nsurlcredential" target="_blank">https://github.com/cvasilak/aerogear-ios/tree/basic.digest.nsurlcredential</a>&gt; was<br>
<div>&gt;         created, this time letting the user to directly pass<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.nsurlcredential/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m#L50" target="_blank">https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.nsurlcredential/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m#L50</a>&gt; an<br>


&gt;         NSURLCredential<br>
&gt;         &lt;<a href="http://developer.apple.com/library/ios/#Documentation/Cocoa/Reference/Foundation/Classes/NSURLCredential_Class/Reference/Reference.html" target="_blank">http://developer.apple.com/library/ios/#Documentation/Cocoa/Reference/Foundation/Classes/NSURLCredential_Class/Reference/Reference.html</a>&gt; object<br>


<div>&gt;         initialised with the username/password combination during the<br>
&gt;         Pipe configuration. Those credentials are internally stored and<br>
&gt;         given back to the system by implementing the necessary callback<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios/blob/basic.digest.nsurlcredential/AeroGear-iOS/AeroGear-iOS/core/AGHttpClient.m#L240" target="_blank">https://github.com/cvasilak/aerogear-ios/blob/basic.digest.nsurlcredential/AeroGear-iOS/AeroGear-iOS/core/AGHttpClient.m#L240</a>&gt;.<br>


<div>&gt;         A usage example can be found in our integration test<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.nsurlcredential/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m" target="_blank">https://github.com/cvasilak/aerogear-ios-integration/blob/basic.digest.nsurlcredential/AeroGear-iOS-Integration/AeroGear-iOS-IntegrationTests/AGHttpBasicAuthenticationTests.m</a>&gt;<br>


<div>&gt;<br>
&gt;         advantages of using the singleton approach:<br>
&gt;         - fits nicely with the authentication mechanism we have in place<br>
&gt;         (as an extension HTTPBasicDigestAuthenticationModule<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios/blob/basic.digest.auth/AeroGear-iOS/AeroGear-iOS/security/AGHttpBasicDigestAuthentication.m" target="_blank">https://github.com/cvasilak/aerogear-ios/blob/basic.digest.auth/AeroGear-iOS/AeroGear-iOS/security/AGHttpBasicDigestAuthentication.m</a>&gt;)<br>


<div>&gt;         so user familiarity when looking to add basic/digest support to<br>
&gt;         the Pipe.<br>
&gt;         - we control the credential type e.g.<br>
&gt;         &#39;NSURLCredentialPersistenceForSession&#39;. This eliminates errors<br>
&gt;         of using &#39;NSURLCredentialPersistencePermanent&#39; and having the<br>
&gt;         user to explicitly clear the keychain when trying to login with<br>
&gt;         a different combination. For my search, many errors occurs<br>
&gt;         because of this.<br>
&gt;<br>
&gt;         disadvantages of using the singleton approach:<br>
&gt;         - not sure if many iOS dev will like the fact of creating an<br>
&gt;         Authenticator object instead of using directly an<br>
&gt;         NSURLCredential object that are used to.<br>
&gt;<br>
&gt;         ---<br>
&gt;         advantages of using the &#39;nsurlcredential&#39; directly:<br>
&gt;         - users familiarity with the object.<br>
&gt;         - not explicit login logout request.<br>
&gt;<br>
&gt;         disadvantages of using the &#39;nsurlcredential&#39; directly:<br>
&gt;         - error credential type can lead to errors.<br>
&gt;<br>
&gt;         With discussions with Matthias, we are more keen in following<br>
&gt;         the HTTPBasicDigestAuthenticationModule<br>
</div>&gt;         &lt;<a href="https://github.com/cvasilak/aerogear-ios/blob/basic.digest.auth/AeroGear-iOS/AeroGear-iOS/security/AGHttpBasicDigestAuthentication.m" target="_blank">https://github.com/cvasilak/aerogear-ios/blob/basic.digest.auth/AeroGear-iOS/AeroGear-iOS/security/AGHttpBasicDigestAuthentication.m</a>&gt; approach<br>


<div>&gt;         instead of providing the NSURLCredential<br>
</div>&gt;         &lt;<a href="http://developer.apple.com/library/ios/#Documentation/Cocoa/Reference/Foundation/Classes/NSURLCredential_Class/Reference/Reference.html" target="_blank">http://developer.apple.com/library/ios/#Documentation/Cocoa/Reference/Foundation/Classes/NSURLCredential_Class/Reference/Reference.html</a>&gt; configuration<br>


<div>&gt;         option on the Pipe. Surely enough, in the documentation we will<br>
&gt;         explicitly state that &quot;login&quot;/ &quot;logout&quot; methods,  serve as a<br>
&gt;         mean to setup internally the iOS authentication system so users<br>
&gt;         don&#39;t have too (instead of calling remote endpoints)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     While the &quot;NSURLCredential&quot; better fits the meanings of BASIC/DIGEST<br>
&gt;     (no explicit login/logout against a server), however that will cause<br>
&gt;     all sorts of issues, since the APP_DEVELOPER is reponsible for<br>
&gt;     providing the NSURLCredential; If we uses a _permanent_ storage, all<br>
&gt;     sorts of errors may occur (like Christos was already indicating).<br>
&gt;<br>
&gt;<br>
&gt;     I (currently) like the &quot;auth_module&quot; approach better. However, as<br>
&gt;     Christos mentioned, we need to state (in API docs) that login/logout<br>
&gt;     is JUST applying/removing the credentials. The doc needs to say that<br>
&gt;     on LOGIN (for instance) no request is hit against the server.<br>
&gt;<br>
&gt;<br>
&gt;     -Matthias<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         Wdyt?<br>
&gt;<br>
&gt;         Thanks,<br>
&gt;         Christos<br>
&gt;<br>
&gt;<br>
&gt;         _______________________________________________<br>
&gt;         aerogear-dev mailing list<br>
</div>&gt;         <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a>&gt;<br>

<div>&gt;         <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     --<br>
&gt;     Matthias Wessendorf<br>
&gt;<br>
&gt;     blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt;     sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt;     twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
&gt;<br>
&gt;     _______________________________________________<br>
&gt;     aerogear-dev mailing list<br>
</div>&gt;     <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a>&gt;<br>

&gt;     <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<div><div>&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; aerogear-dev mailing list<br>
&gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
</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>