session-cookies

Access session cookie in scrapy spiders

吃可爱长大的小学妹 提交于 2019-11-29 00:28:09
问题 I am trying to access the session cookie within a spider. I first login to a social network using in a spider: def parse(self, response): return [FormRequest.from_response(response, formname='login_form', formdata={'email': '...', 'pass':'...'}, callback=self.after_login)] In after_login , I would like to access the session cookies, in order to pass them to another module (selenium here) to further process the page with an authentificated session. I would like something like that: def after

Set cookie for domain instead of subDomain using NodeJS and ExpressJS

≡放荡痞女 提交于 2019-11-29 00:13:08
问题 I have been using expressjs and mongostore for session management. Following is the code to configure store in expressjs, app.configure(function(){ app.use(express.session({ secret: conf.secret, maxAge: new Date(Date.now() + 3600000), cookie: { path: '/' }, store: new MongoStore(conf.db) })); }); I had mentioned the cookie path in the above code. But it sets the cookie in sub.domain.com instead of .domain.com. How do i achieve this? 回答1: configure it like this: app.use(express.session({

Security of Token Based Authentication

限于喜欢 提交于 2019-11-29 00:12:32
My understanding of token based authentication is that upon authentication (perhaps over ssl), a token is passed to the user for cheap user verification on the fly. One implementation of this would be to generate a cookie that is passed to the user for session management. But, my understanding is that token based auth (at least through cookies) is susceptible to man in the middle attacks like firesheep. Are there other methods of implementation that skirt this major security issue, or do I have a fundamental misunderstanding of tba? Your understanding is good. Fundamentally, in terms of how

Fully disable cookies in Laravel 4 API

a 夏天 提交于 2019-11-28 19:44:34
I am using Laravel to build a RESTful API. I use Basic HTTP Auth ( Authenticate header ), with this filter: Route::filter('auth', function() { $credentials = ['email' => Request::getUser(), 'password' => Request::getPassword()]; if (!Auth::once($credentials)) { $response = ['error' => true, 'message' => 'Unauthorized request']; $code = 401; $headers = ['WWW-Authenticate' => 'Basic']; return Response::json($response, $code, $headers); } }); It works, but Laravel then tries to set a cookie for the user (sending a Set-Cookie header). I tried setting the session.driver configuration key to array ,

TokenMismatchException in VerifyCsrfToken.php line 53 in Laravel 5.1

旧时模样 提交于 2019-11-28 13:27:36
When I try to login show me token error. I have checked token in view form it's right and when comment \App\Http\Middleware\VerifyCsrfToken::class , in the Kernel.php it makes me login but after Redirect to my dashboard I'm not logged in. I am using MAMP on mac. <div> <h1>Login</h1> <div> {!! Form::open(['url'=>'user/login','class' => '']) !!} <input type="hidden" name="_token" value="{{ csrf_token() }}"> <ul> <li><label>Customer Code</label>{!!Form::Text('customer_code',Input::old('customer_code'),['class'=>''])!!}</li> <li><label>Password</label>{!!Form::Password('password','',['class'=>''])

Express session with different cookie domain per request?

孤人 提交于 2019-11-28 09:16:35
I have a situation where an app can be accessed from multiple different domains. For instance, foo.com and bar.com could both in theory point to my app. Additionally, their subdomains can also point to my app, so for instance red.foo.com and blue.foo.com . I'm using Express cookie sessions, and my initialization code for the session looks like that: app.use(express.session({ secret: "secret", cookie: { domain: ".foo.com" }, store: new MongoStore({ db: db }) })); That works well for when users go through foo.com or any of it's subdomains, but bar.com won't work. I need to have both at once.

Delete PHP Cookie?

对着背影说爱祢 提交于 2019-11-28 07:39:12
问题 I currently have a cookie set as follows: setcookie("username",$username,time()+3600*24*5); How would I go about clearing the value of that cookie so that the user's username isn't filled in anymore? I have it cleared as follows: setcookie("username","",time()-60000); The user's username still comes up though. The HTML form: <?php session_start(); $username = NULL; $password = NULL; if(isset($_SESSION['username'])){ $username = $_COOKIE['username']; $password = $_COOKIE['password']; } ?>

How to change jsessionid cookie path to server root in Spring app on Jetty?

感情迁移 提交于 2019-11-28 07:02:31
问题 I have a Jetty server running a Spring app on the /app context. The app uses sessions, so it sets a session cookie, which responds like this: set-cookie:JSESSIONID=679b6291-d1cc-47be-bbf6-7ec75214f4e5; Path=/app; HttpOnly I need that cookie to have a path of / instead of the webapp's context. Plus I want to use secure cookies. I want this response: set-cookie:JSESSIONID=679b6291-d1cc-47be-bbf6-7ec75214f4e5; Path=/; HttpOnly; Secure Where is the proper place to configure the session cookie?

Forcing Tomcat to use secure JSESSIONID cookie over http

本秂侑毒 提交于 2019-11-28 06:21:33
Is there a way to configure Tomcat 7 to create JSESSIONID cookie with a secure flag in all occasions? Usual configuration results in Tomcat flagging session cookie with secure flag only if connection is made through https. However in my production scenario, Tomcat is behind a reverse proxy/load balancer which handles (and terminates) the https connection and contacts tomcat over http. Can I somehow force secure flag on session cookie with Tomcat, even though connection is made through plain http? In the end, contrary to my initial tests, web.xml solution worked for me on Tomcat 7. E.g. I added

Setting HTTPONLY for Classic Asp Session Cookie

99封情书 提交于 2019-11-28 05:49:24
Does anyone know exactly how to set HTTPONLY on classic ASP session cookies? This is the final thing that's been flagged in a vulnerability scan and needs fixing ASAP, so any help is appreciated. ~~~A LITTLE MORE INFORMATION ON MY PROBLEM~~~ Can anyone please help me with this? I need to know how to set HTTPONLY on the ASPSESSION cookie created by default from ASP & IIS. This is the cookie automatically created by the server for all asp pages. If needed i can set HTTPONLY on all cookie across the site. Any help on how to do this would be massively appreciated. Thanks Thanks Elliott Microsoft