session

PHP How to stop Chrome loading a page twice

孤街醉人 提交于 2020-04-29 23:37:42
问题 Note: I have updated and rewritten my question to try and solve this issue point by point. Cheers. I have a problem and I'm not immediately sure how to go about resolving it. I have been building a secured login system on a HTTPS server (with a grade of "A" by SSL-labs, if that's worth anything ), and it works fine, however today it is refusing to log me in, with some debugging I have found something very odd (in my view). I have some serious issues with session handling on the website, the

How are cookie-http-only sessions supposed to work on a SPA with a separate API server?

家住魔仙堡 提交于 2020-04-17 18:51:43
问题 When trying to figure out how to authenticate with Facebook/Google in the context of an SPA I'm building, someone pointed me to Stop using JWT for sessions. I'm trying to give it a try, using HTTP-Only Cookies. My server is Ruby on Rails with Devise and my client is JavaScript with React, although the conceptual solution is independent of specific tech I believe. My app gets loaded by going to projectx.lvh.me and then it makes a query to api.projectx.lvh.me to fetch the current user. At the

How are cookie-http-only sessions supposed to work on a SPA with a separate API server?

做~自己de王妃 提交于 2020-04-17 18:48:03
问题 When trying to figure out how to authenticate with Facebook/Google in the context of an SPA I'm building, someone pointed me to Stop using JWT for sessions. I'm trying to give it a try, using HTTP-Only Cookies. My server is Ruby on Rails with Devise and my client is JavaScript with React, although the conceptual solution is independent of specific tech I believe. My app gets loaded by going to projectx.lvh.me and then it makes a query to api.projectx.lvh.me to fetch the current user. At the

How are cookie-http-only sessions supposed to work on a SPA with a separate API server?

一笑奈何 提交于 2020-04-17 18:46:36
问题 When trying to figure out how to authenticate with Facebook/Google in the context of an SPA I'm building, someone pointed me to Stop using JWT for sessions. I'm trying to give it a try, using HTTP-Only Cookies. My server is Ruby on Rails with Devise and my client is JavaScript with React, although the conceptual solution is independent of specific tech I believe. My app gets loaded by going to projectx.lvh.me and then it makes a query to api.projectx.lvh.me to fetch the current user. At the

How are cookie-http-only sessions supposed to work on a SPA with a separate API server?

倾然丶 夕夏残阳落幕 提交于 2020-04-17 18:44:59
问题 When trying to figure out how to authenticate with Facebook/Google in the context of an SPA I'm building, someone pointed me to Stop using JWT for sessions. I'm trying to give it a try, using HTTP-Only Cookies. My server is Ruby on Rails with Devise and my client is JavaScript with React, although the conceptual solution is independent of specific tech I believe. My app gets loaded by going to projectx.lvh.me and then it makes a query to api.projectx.lvh.me to fetch the current user. At the

How long php sessions are stored in server?

做~自己de王妃 提交于 2020-04-10 06:30:50
问题 I'm wondering how long php sessions are stored in server memory.What if user logs in (sets session variables in server) and he keeps his browser open for a long time suppose 30 days and he reloads the page on the 31st day? Can browser access session variables(browser still has session cookie)? 回答1: Default php.ini sets the session expiration time to 30 minutes. Check out these settings: session.gc_maxlifetime and session.cookie_lifetime As long as the browser have the cookie stored, it doesn

zookeeper系列问题总结

余生长醉 提交于 2020-04-08 12:21:37
这段时间来,也在和公司里的一些同学交流使用zk的心得,整理了一些常见的zookeeper问题。这个页面的目标是解答一些zk常见的使用问题,同时也让大家明确zk不能干什么。页面会一直更新。 1. 客户端对ServerList的轮询机制是什么 随机,客户端在初始化( new ZooKeeper(String connectString, int sessionTimeout, Watcher watcher) )的过程中,将所有Server保存在一个List中,然后随机打散,形成一个环。之后从0号位开始一个一个使用。 两个注意点:1. Server地址能够重复配置,这样能够弥补客户端无法设置Server权重的缺陷,但是也会加大风险。(比如: 192.168.1.1:2181,192.168.1.1:2181,192.168.1.2:2181). 2. 如果客户端在进行Server切换过程中耗时过长,那么将会收到SESSION_EXPIRED. 这也是上面第1点中的加大风险之处。更多关于客户端地址列表相关的,请查看文章《 ZooKeeper客户端地址列表的随机原理 》 2 .客户端如何正确处理CONNECTIONLOSS(连接断开) 和 SESSIONEXPIRED(Session 过期)两类连接异常 在ZooKeeper中,服务器和客户端之间维持的是一个长连接,在 SESSION

Fiddler使用方法简介

六月ゝ 毕业季﹏ 提交于 2020-04-08 10:40:03
Hi all : 近期我较细化的学习了Fiddler的一些使用方法,在此梳理和总结出一份文档,希望能对大家有些许帮助。 请大家重点看第二部分的主要功能介绍,第三部分由于工具栏下目录太多,我写的有点乱,需要大家自己慢慢动手尝试一下。 一. 背景 在近两个月的群问问版本测试中,测试的重点在于功能,但大家在测试过程中,经常由于对相关代码和数据返回的不了解,处于被动的状态。 近期我较细致的学习Fiddler,梳理一份文档,希望能对大家有点帮助。代码的梳理也在进行中,后续也会整理出来。 二. Fiddler的使用界面和各模块主要功能介绍: 以下来介绍图中所标的功能:    请求列表:请求列表中包含了许多信息,从左至右依次为,#(序列号),Result(结果状态码),Prottocol(请求的协议),Host(请求的主机名),URL(具体链接),Body(请求的内容大小),Caching(缓存),Content-Type(响应的HTTP内容类型),Process(请求所运行的程序),Comments(注释),Custom(不知,好像也无用) 监听开关:在最左下角,显示capturing代表捕捉状态,此时fiddler工作。鼠标点击一次后,Fiddler就休息。这个小功能可以方便测试人员在线上与测试环境之间来回切换。 监听类型:有四种状态,分别是,监听所有请求,监听浏览器请求,监听非浏览器请求

0xx_PHP核心02

懵懂的女人 提交于 2020-04-08 03:23:59
typora-copy-images-to: images 1.1 今日目标 理解会话技术的概念; 理解会话技术产生的原因和工作原理; 理解session的工作原理; 理解session与cookie的关系; 掌握session与cookie的区别; 了解session的配置与作用; 理解session入库的作用; 掌握session入库的原理; 能够封装session入库的类; 1.2 Session(会话) 1.2.1 原理 1、session是服务器端的技术 2、session是基于cookie技术的 1.2.2 session操作 1、默认情况下,会话不会自动开启,通过session_start()开启会话 2、通过session_id()获取会话的编号 3、通过$_SESSION操作会话 4、会话可以保存除了资源以外的所有类型。 5、重复开启会话会报错,一般出现在包含文件中。 <?php session_start(); //开启会话 @session_start(); //重复开启会话会报错,可以通过错误抑制符来屏蔽错误 $_SESSION['name']='tom'; //保存会话 $_SESSION['age']=20; echo $_SESSION['name'],'<br>'; echo $_SESSION['age'],'<br>'; echo '会话编号:'

hibernate HelloWorld

南楼画角 提交于 2020-04-07 18:27:15
Hibernate是典型的ORM框架,对JDBC进行轻量级的封装,能够使程序员更加便捷的操作对象 可以去hibernate官网去下载,版本之间差异不大,我是用的是Hibernate 4.3 搭建Hibernate环境步骤: 一、 使用xml文件映射   1.下载Hibernate包   2.解压后,找到 lib/required 文件夹下的jar包就是一个hibernate程序所必需的   3.新建java工程,把jar包添加到工程中去   4.在src目录下新建*.cfg.xml文件,这是hibernate默认的配置文件,该配置文件中指定数据库驱动、用户名、密码等,还有hibernate的自身配置,是否显示SQL    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- 配置连接数据库的基本信息 --> <property name=