Module: WEBrick::HTTPAuth::SoksUserCookie

Included in:
AskForUserName, NoAuthenticationRequired, SiteWidePassword
Defined in:
lib/authenticators.rb

Instance Method Summary collapse

Instance Method Details



17
18
19
20
21
22
# File 'lib/authenticators.rb', line 17

def add_cookie(request,response)
	cookie = WEBrick::Cookie.new( 'username', request.user )
	cookie.path = '/'
	cookie.expires = Time.now + ( 60 * 60 * 24 * 180 ) # Expires in 180 days
	response.cookies << cookie
end


11
12
13
14
15
# File 'lib/authenticators.rb', line 11

def username_from_cookie(request)
	cookie = request.cookies.find { |cookie| cookie.name == 'username' }
	return cookie.value if cookie
	return nil
end