Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

How to modify session cookie name on HTTP authorization ?

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Advanced programming
View previous topic :: View next topic  
Author Message
mbchowdari



Joined: 08 May 2008
Posts: 52

PostPosted: Wed Jul 01, 2009 3:31 am    Post subject: How to modify session cookie name on HTTP authorization ? Reply with quote

Hi,

I'm trying to make a secure RSS feed for my site, and I want to separate it from the rest of the application, but whenever I use "authenticate_or_request_with_http_basic" it replaces the cookie used to store session information for the rest of the site.

So when I login, using HTTP Basic Authentication, it replaces the cookie used to store session information for the rest of the site, and I become logged out on it.
I'd like to change the name of the cookie used with authenticate_or_request_with_http_basic.

Any idea on how to go about it?


Thank you,
Chowdari.
Back to top
View user's profile Send private message Send e-mail
s.nagesh



Joined: 23 Jul 2007
Posts: 115

PostPosted: Wed Jul 01, 2009 3:34 am    Post subject: Reply with quote

Hi chowdari,


I'm able to modify the cookie name for the RSS controller by using session

:session_key => "cookiename"

But as soon as I login using HTTP basic authentication it some how messes with the session on the rest of the site, which uses a cookie with another name to authenticate.

It doesn't matter what I set the cookie names to, as long as I am logged in with HTTP basic authentication the session for the rest of the site isn't handled correctly.

Here's my code:


class RssController < ActionController::Base
before_filter :verify_access
session :session_key => "_rss_session_id_"

def rss
@audits = Audit.find(
:all,
:limit => 20,
:order => 'audits.created_at asc',
:joins => 'JOIN memberships ON memberships.group_id = audits.group_id',
:conditions => "memberships.user_id = #{@current_user_rss.id} AND memberships.status = 1")
puts @audits.inspect()
respond_to do |format|
format.rss
end
end

def verify_access
ic = Iconv.new('UTF-8', 'latin1')
authenticate_or_request_with_http_basic("Private RSS-feed") do |username, password|
username = ic.iconv(username)
password = ic.iconv(password)
@current_user_rss = User.authenticate(username, password)
if @current_user_rss
true
else
false
end
end
end
end

let me konw if you have any problem..

Regards,
nagesh.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Advanced programming
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts About Modules,Mixins and Namespaces
0 swaminadhan 6 Sat Mar 20, 2010 12:01 pm
swaminadhan View latest post
No new posts Railsdav plugin
0 swaminadhan 8 Sat Mar 20, 2010 11:20 am
swaminadhan View latest post
No new posts Deploying the rails applicatin in Heroku
0 Divya 11 Fri Mar 19, 2010 12:23 pm
Divya View latest post
No new posts overridig existing methods
0 Raja 13 Fri Mar 19, 2010 11:28 am
Raja View latest post
No new posts Class Methods
0 Raja 10 Fri Mar 19, 2010 11:04 am
Raja View latest post
No new posts Objects methods
0 Raja 12 Fri Mar 19, 2010 10:50 am
Raja View latest post
No new posts Documentation
0 Anu 23 Thu Mar 18, 2010 4:01 am
Anu View latest post
No new posts File handling in ruby
0 Anu 30 Wed Mar 17, 2010 2:14 pm
Anu View latest post
No new posts sending an email from rb file
0 umamahesh_nyros 21 Wed Mar 17, 2010 6:13 am
umamahesh_nyros View latest post
No new posts difference bewteen render component and render partial
0 umamahesh_nyros 19 Wed Mar 17, 2010 6:06 am
umamahesh_nyros View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More