Quantcast

REST API - advice

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

REST API - advice

cazacugmihai
Hi,

I'm trying to decouple my applications using this schema:

[db1] \                 / [android]
[db2]  - [rest api] -  [iphone]
[dbN] /                \ [web]

and I don't know how to implement authentication/authorization for REST requests. What do you recommend: 
basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?

Eventually, do you know some useful links?

Thanks,
Mihai

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

mjparme
Two-legged oauth is one option. You won't actually find that term in the oauth specification; however, if you are just wanting API authentication then all you need is the message signing parts of oauth. Using it this way has become colloquially referred to as two-legged oauth.

There is some sample code from the oauth group here (it is a subversion repository that has anonymous read on):

http://oauth.googlecode.com/svn/code/java/

Specifically for the message validation take a look at the validateMessage() method in the SimpleOAuthValidator class.

http://oauth.googlecode.com/svn/code/java/jmeter/core/commons/src/main/java/net/oauth/SimpleOAuthValidator.java

Basically how it works is you give a private key (consumer secret in oauth speak) to the person (different for each user) using your api. They hash the calls to your API with their secret key, then when you get the request you do the same hashing algorithm (since you have the private key too) and if they match you now that person is authenticates. A username is also passed in the request (consumer key in oauth speak), if they authenticate then you can authorize with that username (and of course you need that username to look up their private key). The only time the private key is sent over the wire is during the initial key exchange (use SSL website to generate and transfer).

OAuth has a very strict way of generating the hash that is the message signature (Section 3 of the RFC http://tools.ietf.org/html/rfc5849#section-3). The sample code I link to above has an implementation of it. As far as user's making requests to your API there are plenty of libraries out there that can generate good oauth requests (i.e. with the strict hash generation in section 3) in a variety of languages (see http://oauth.net/code/). Signpost can generate oauth requests if your API users will be using Java: http://code.google.com/p/oauth-signpost/

The only thing that would then be up to you is generation of the private keys. You can hit google for some ideas. One way if you run on a unix platform you can get read random bytes from /dev/random then hash them. (how many bytes you read will determine how secure your keys are).

On Aug 2, 2012, at 11:46 AM, Mihai Cazacu <[hidden email]<mailto:[hidden email]>> wrote:

Hi,

I'm trying to decouple my applications using this schema:

[db1] \                 / [android]
[db2]  - [rest api] -  [iphone]
[dbN] /                \ [web]

and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?

Eventually, do you know some useful links?

Thanks,
Mihai



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

mjparme
In reply to this post by cazacugmihai
Here is another good writeup. He ends up describing two-legged oauth:

http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/


On Aug 2, 2012, at 11:46 AM, Mihai Cazacu <[hidden email]> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?
>
> Thanks,
> Mihai
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
In reply to this post by mjparme
Hi, Michael!

On Thu, Aug 2, 2012 at 8:18 PM, Parmeley, Michael <[hidden email]> wrote:
Two-legged oauth is one option. You won't actually find that term in the oauth specification; however, if you are just wanting API authentication then all you need is the message signing parts of oauth. Using it this way has become colloquially referred to as two-legged oauth.

The REST API will not be used only for the authentication. It will be the layer between the DB and apps.
 
There is some sample code from the oauth group here (it is a subversion repository that has anonymous read on):

http://oauth.googlecode.com/svn/code/java/

Specifically for the message validation take a look at the validateMessage() method in the SimpleOAuthValidator class.

http://oauth.googlecode.com/svn/code/java/jmeter/core/commons/src/main/java/net/oauth/SimpleOAuthValidator.java

Basically how it works is you give a private key (consumer secret in oauth speak) to the person (different for each user) using your api. They hash the calls to your API with their secret key, then when you get the request you do the same hashing algorithm (since you have the private key too) and if they match you now that person is authenticates. A username is also passed in the request (consumer key in oauth speak), if they authenticate then you can authorize with that username (and of course you need that username to look up their private key). The only time the private key is sent over the wire is during the initial key exchange (use SSL website to generate and transfer).

Ok, this means that every client (ex: every mobile app) need to have a public/secret key. Is it possible to provide this keys for each application installed via appstore (iphone/android/etc)? 
 
OAuth has a very strict way of generating the hash that is the message signature (Section 3 of the RFC http://tools.ietf.org/html/rfc5849#section-3). The sample code I link to above has an implementation of it. As far as user's making requests to your API there are plenty of libraries out there that can generate good oauth requests (i.e. with the strict hash generation in section 3) in a variety of languages (see http://oauth.net/code/). Signpost can generate oauth requests if your API users will be using Java: http://code.google.com/p/oauth-signpost/

Nice tool! 
 
The only thing that would then be up to you is generation of the private keys. You can hit google for some ideas. One way if you run on a unix platform you can get read random bytes from /dev/random then hash them. (how many bytes you read will determine how secure your keys are).

Instead applying the hash algorithm for each request, is not a better option to use oauth2

Thanks for your help!
Mihai
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
In reply to this post by mjparme
I read that article. Still I don't know how to provide the secret key to an application downloaded from appstore or any other mobile store.


On Thu, Aug 2, 2012 at 8:35 PM, Parmeley, Michael <[hidden email]> wrote:
Here is another good writeup. He ends up describing two-legged oauth:

http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/


On Aug 2, 2012, at 11:46 AM, Mihai Cazacu <[hidden email]> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?
>
> Thanks,
> Mihai
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
Some things about Oauth2:  http://hueniverse.com/2012/07/oauth-2-0-and-the-road-to-hell/ 

On Thu, Aug 2, 2012 at 8:42 PM, Mihai Cazacu <[hidden email]> wrote:
I read that article. Still I don't know how to provide the secret key to an application downloaded from appstore or any other mobile store.


On Thu, Aug 2, 2012 at 8:35 PM, Parmeley, Michael <[hidden email]> wrote:
Here is another good writeup. He ends up describing two-legged oauth:

http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/


On Aug 2, 2012, at 11:46 AM, Mihai Cazacu <[hidden email]> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?
>
> Thanks,
> Mihai
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: <a href="tel:%2B40%20745%20254%20657" value="+40745254657" target="_blank">+40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Marc Palmer Local
In reply to this post by cazacugmihai

On 2 Aug 2012, at 17:46, Mihai Cazacu <[hidden email]> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?

I'm currently still a fan of conventional HTTP Basic auth using disposable API Keys. Preferably over SSL where that is important.

Remember however that SSL is not for encryption, it is for trust.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Nathan Wells

... wait, what? How is SSL not for encryption?

On Aug 2, 2012 12:38 PM, "Marc Palmer" <[hidden email]> wrote:

On 2 Aug 2012, at 17:46, Mihai Cazacu <[hidden email]> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?

I'm currently still a fan of conventional HTTP Basic auth using disposable API Keys. Preferably over SSL where that is important.

Remember however that SSL is not for encryption, it is for trust.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
In reply to this post by Marc Palmer Local
I think I'll go with your advice. Keeping things simple...

Thanks!

On Thu, Aug 2, 2012 at 9:38 PM, Marc Palmer <[hidden email]> wrote:

I'm currently still a fan of conventional HTTP Basic auth using disposable API Keys. Preferably over SSL where that is important.

Remember however that SSL is not for encryption, it is for trust.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

mjparme
In reply to this post by cazacugmihai
If your users need to register then you can generate a secret key at that time and then you will have to store it on the device.

On Aug 2, 2012, at 12:42 PM, Mihai Cazacu <[hidden email]<mailto:[hidden email]>> wrote:

I read that article. Still I don't know how to provide the secret key to an application downloaded from appstore or any other mobile store.


On Thu, Aug 2, 2012 at 8:35 PM, Parmeley, Michael <[hidden email]<mailto:[hidden email]>> wrote:
Here is another good writeup. He ends up describing two-legged oauth:

http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/


On Aug 2, 2012, at 11:46 AM, Mihai Cazacu <[hidden email]<mailto:[hidden email]>> wrote:

> Hi,
>
> I'm trying to decouple my applications using this schema:
>
> [db1] \                 / [android]
> [db2]  - [rest api] -  [iphone]
> [dbN] /                \ [web]
>
> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>
> Eventually, do you know some useful links?
>
> Thanks,
> Mihai
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]<mailto:[hidden email]>
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

mjparme
In reply to this post by Marc Palmer Local
SSL is most definitely for encryption, Secure Socket Layer. If you are using HTTP Basic Auth you should be using SSL as well otherwise your API keys and/or credentials are transmitted in the clear.


On Aug 2, 2012, at 1:38 PM, Marc Palmer <[hidden email]> wrote:

>
> On 2 Aug 2012, at 17:46, Mihai Cazacu <[hidden email]> wrote:
>
>> Hi,
>>
>> I'm trying to decouple my applications using this schema:
>>
>> [db1] \                 / [android]
>> [db2]  - [rest api] -  [iphone]
>> [dbN] /                \ [web]
>>
>> and I don't know how to implement authentication/authorization for REST requests. What do you recommend:
>> basic auth + SSL, oauth1, oauth2, SSL only for login and the rest of the requests using an accessToken?
>>
>> Eventually, do you know some useful links?
>
> I'm currently still a fan of conventional HTTP Basic auth using disposable API Keys. Preferably over SSL where that is important.
>
> Remember however that SSL is not for encryption, it is for trust.
>
> Marc
>
> ~ ~ ~
> Marc Palmer
> Freelancer (Grails/Groovy/Java/UX)
>
> I offer commercial support for Grails plugins from as low as $50/mo.
> For details see: http://grailsrocks.com
>
> Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
> Contributor @ http://grails.org |  Founder @ http://noticelocal.com
> Developer @ http://weceem.org | Member @ http://spottymushroom.com
> Twitter: http://twitter.com/wangjammer5 
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Marc Palmer Local
In reply to this post by Nathan Wells

On 2 Aug 2012, at 20:09, Nathan Wells <[hidden email]> wrote:

> ... wait, what? How is SSL not for encryption?

Good post here: http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html


~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Marc Palmer Local
In reply to this post by cazacugmihai

On 2 Aug 2012, at 20:11, Mihai Cazacu <[hidden email]> wrote:

> I think I'll go with your advice. Keeping things simple...
>
> Thanks!
>
> On Thu, Aug 2, 2012 at 9:38 PM, Marc Palmer <[hidden email]> wrote:
>
> I'm currently still a fan of conventional HTTP Basic auth using disposable API Keys. Preferably over SSL where that is important.
>
> Remember however that SSL is not for encryption, it is for trust.

Let me clarify with my rationale:

1) OAuth 2 is a complete interop mess and a hassle to code
2) OAuth 1 requires signing stuff
3) Basic auth with tokens instead of passwords is very quick and easy to auth and test using e.g. curl

Still recommended that you use SSL and hash passwords during "authorisation" in the API to get your API key, to avoid people sniffing. Also need a policy / API calls / UI for regenerating keys if applicatible to your app.

Stuff is always complicated in a multi-device world.

Marc
~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
What do you mean with "Basic auth with tokens instead of passwords" (let's say for a mobile app downloaded from appstore)? 


On Thu, Aug 2, 2012 at 10:37 PM, Marc Palmer <[hidden email]> wrote:

Let me clarify with my rationale:

1) OAuth 2 is a complete interop mess and a hassle to code
2) OAuth 1 requires signing stuff
3) Basic auth with tokens instead of passwords is very quick and easy to auth and test using e.g. curl

Still recommended that you use SSL and hash passwords during "authorisation" in the API to get your API key, to avoid people sniffing. Also need a policy / API calls / UI for regenerating keys if applicatible to your app.

Stuff is always complicated in a multi-device world.

Marc
~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

rlovtangen
In reply to this post by Marc Palmer Local

On Aug 2, 2012, at 9:24 PM, Marc Palmer wrote:

>
> On 2 Aug 2012, at 20:09, Nathan Wells <[hidden email]> wrote:
>
>> ... wait, what? How is SSL not for encryption?
>
> Good post here: http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html

It's still for encryption, but as the article explains, the trust part is probably the most important aspect.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Nathan Wells
That is a good article. I don't know that I buy that the trust (authentication) part of SSL is more important than the encryption part. Maybe because we've become so trusting of the networks we live on.

In any case, we don't need to really hash this topic out right here </off-topic>

Nathan Wells


On Thu, Aug 2, 2012 at 2:39 PM, Ronny Løvtangen <[hidden email]> wrote:

On Aug 2, 2012, at 9:24 PM, Marc Palmer wrote:

>
> On 2 Aug 2012, at 20:09, Nathan Wells <[hidden email]> wrote:
>
>> ... wait, what? How is SSL not for encryption?
>
> Good post here: http://www.troyhunt.com/2011/01/ssl-is-not-about-encryption.html

It's still for encryption, but as the article explains, the trust part is probably the most important aspect.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Marc Palmer Local

On 3 Aug 2012, at 06:06, Nathan Wells <[hidden email]> wrote:

> That is a good article. I don't know that I buy that the trust (authentication) part of SSL is more important than the encryption part. Maybe because we've become so trusting of the networks we live on.
>
> In any case, we don't need to really hash this topic out right here </off-topic>

Indeed. What I meant was, for authentication at least, you should never be transferring clear text credentials anyway, they should always be hashed (and salted), even if over SSL.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
1. What do you mean with "Basic auth with tokens instead of passwords" (let's say for a mobile app downloaded from appstore)?  

2. You say that the password will be hashed and salted on the client? I though that this action happens on the server side.


On Fri, Aug 3, 2012 at 11:11 AM, Marc Palmer <[hidden email]> wrote:

What I meant was, for authentication at least, you should never be transferring clear text credentials anyway, they should always be hashed (and salted), even if over SSL.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

Marc Palmer Local

On 3 Aug 2012, at 10:25, Mihai Cazacu <[hidden email]> wrote:

> 1. What do you mean with "Basic auth with tokens instead of passwords" (let's say for a mobile app downloaded from appstore)?  
>

You have REST API calls for:

1) registration
2) login

Depending on your auth policy (is email confirmation required etc) you take encoded passwords as payload on those two calls and store them in the server, and the responses typically would include an API key that is used as HTTP Basic auth on all future REST requests.

The API key can be stored in the client until such a time that the credentials are rejected by the server (i.e. after a password reset or key regen due to compromise), so future login calls are not needed unless the user re-installs the app or provisions a new device.

> 2. You say that the password will be hashed and salted on the client? I though that this action happens on the server side.

There's no reason to send the actual password over the wire. Even under SSL is it an unnecessary security risk. The server does not need to know anything about real passwords, just a hash value to compare to.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: REST API - advice

cazacugmihai
Thanks, Marc! I'll follow your advises.

On Fri, Aug 3, 2012 at 12:56 PM, Marc Palmer <[hidden email]> wrote:

On 3 Aug 2012, at 10:25, Mihai Cazacu <[hidden email]> wrote:

> 1. What do you mean with "Basic auth with tokens instead of passwords" (let's say for a mobile app downloaded from appstore)?
>

You have REST API calls for:

1) registration
2) login

Depending on your auth policy (is email confirmation required etc) you take encoded passwords as payload on those two calls and store them in the server, and the responses typically would include an API key that is used as HTTP Basic auth on all future REST requests.

The API key can be stored in the client until such a time that the credentials are rejected by the server (i.e. after a password reset or key regen due to compromise), so future login calls are not needed unless the user re-installs the app or provisions a new device.

> 2. You say that the password will be hashed and salted on the client? I though that this action happens on the server side.

There's no reason to send the actual password over the wire. Even under SSL is it an unnecessary security risk. The server does not need to know anything about real passwords, just a hash value to compare to.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Mihai Cazacu
Software Engineer
E-mail: [hidden email]
Mobile: +40 745 254 657
Skype: cazacugmihai
Twitter: cazacugmihai


12
Loading...