Hi Sameera,
That should work out of the box. In the simplest case, use a
before_filter :login_required ( this is described in lib/
authenticated_system.rb) to restrict access to any set of controller
actions, and use HTTP basic authentication from the remote end
(requesting .xml, .json, etc). If you look in lib/
authenticated_system.rb this is tried after login_by_session and
login_by_cookie for any page request that expects a current_user. If
you''d like to know more on HTTP basic auth there''s an
excellent
(natch) railscast here: http://railscasts.com/episodes/82 and I''m sure
google will have one or two links for you.
One thing to watch out for: if you use any kind of activation/email
validation/etc the current version of restful_authentication doesn''t
check that the user is active, only that their password
authenticates. I''ve handled that by routing all non-session logins
through a single become_logged_in_as! method; it raises an exception
if the user isn''t authorized to login.
Cheers,
flip
On May 28, 2:17 am, Sameera Gayan
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi All,
>
> I have created a RESTful web api and it works fine. I have manage to use
> RESTFulauthenticationalso.
>
> My problem is, how can i implementauthenticationfor external clients.
>
> Ex : If my Web service is consumed by a desktop application, how will i
> be able to implementauthentication. ?!!
>
> Is there any standard way or how can i get this done
> Please advice me
>
> thankx in advance
>
> cheers
> sameera
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---