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: 131

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 How to customize Google Maps InfoWindow using ym4r_gm
0 kalyanallampalli 9 Thu Sep 02, 2010 5:34 pm
kalyanallampalli View latest post
No new posts Drag and Drop file upload
0 umamageshwari 19 Wed Sep 01, 2010 9:36 am
umamageshwari View latest post
No new posts Flex On Rails
0 Raghu 13 Wed Sep 01, 2010 3:00 am
Raghu View latest post
No new posts MongoDB
0 Raghu 17 Tue Aug 31, 2010 3:30 pm
Raghu View latest post
No new posts Problem with Dreamweaver / java error
3 Raja 19 Tue Aug 31, 2010 3:24 pm
Raghu View latest post
No new posts Generating Model
0 phani.galla 18 Tue Aug 31, 2010 2:09 pm
phani.galla View latest post
No new posts Hide Panels using JQuery
0 Anu 24 Tue Aug 31, 2010 1:50 pm
Anu View latest post
No new posts Load a text file using ajax in jquery
0 Anu 23 Tue Aug 31, 2010 1:39 pm
Anu View latest post
No new posts Generating Migrations
0 phani.galla 18 Tue Aug 31, 2010 1:38 pm
phani.galla View latest post
No new posts Generating Controllers
0 phani.galla 20 Tue Aug 31, 2010 1:22 pm
phani.galla 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