解决iframe中jsessionid无法传递导致session丢失的问题

在实现 ISMP2.1.1 接口的适合需要用到sso,而ISMP里定义的接口是需要在iframe等嵌入页面中调用sso接口,在实际开发中发现session无法正常传递。

重现问题的场景是:

1.先访问a站点:http://192.168.18.2/test.jsp

test.jsp的代码为:

<html>
<head>
<title> 618119.com </title>
</head>
<body>
<iframe src=”http://192.168.18.3/sso.jsp?ssoinfo=xxxx“>
</iframe>
</body>
</html>

sso.jsp里读取传递的ssoinfo,反向调用ISMP认证接口,

生成session,然后放入指定的属性值,

session.setAttribute(“ssoUser”,”lizongbo”);
页面再重定向到 http://192.168.18.3/iframe.jsp

response.sendRedirect(“/iframe.jsp”);

iframe.jsp中读取session中ssoUser的属性值,会发现无法读取。
2.如果先访问了 192.168.18.3的页面,再访问192.168.18.2的页面,此时的iframe嵌入是可以传递已生成好的jsessionid Cookie.

因此解决的办法有:

a.在url中加上jsessionid.

例如重定向到 response.sendRedirect(“/iframe.jsp;jsessionid=lizongbo”);
而这种情况下,如果iframe.jsp页面内的其它连接的url没有加上jsessionid,

也无法继续传递session,不过通过在客户端的js来为每个超连接的href属性重写加上jsessionid.

b.sso.jsp里设置P3P头信息
例如 P3P: CP=”CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR”

或 P3P:CP=”CAO PSA OUR”

java代码为:

response.addHeader(“P3P”,”\”CAO PSA OUR\”");

 

 

===============================

1.将隐私调低也可以解决该问题

2.将ifame里的地址加入到可信站点

Cookie、Session、Token、JWT与OAuth2:Web认证授权核心概念全解析 在Web开发中,认证与授权是保障应用安全的核心机制。其基本原理是解决HTTP无状态协议下的用户身份识别与权限管理问题。从技术实现上看,经典的Cookie-Session机制通过在客户端存储标识、服务端维护会话状态来实现有状态认证;而基于Token的无状态认证,则将用户信息编码在令牌中,由客户端存储并在请求时携带,服务器通过验证签名即可识别身份,这显著提升了分布式系统的扩展性。JWT作为Token的一种流行标准,采用结构化格式(Header.Payload.Signature)实现信息自包含与防篡改,广泛应用 阅读详情

相关推荐

Web身份认证全解析:从Session、JWT到SSO与安全实践

Web身份认证是解决HTTP无状态协议下用户身份识别问题的核心技术。其核心原理是通过凭证(如Session ID或Token)在客户端与服务器之间建立信任关系,使服务器能够识别请求的发起者。这项技术的价值在于保障用户数据安全、实现跨系统状态管理,并作为防御CSRF、XSS等攻击的基础防线。从经典的Session-Cookie机制到现代无状态的JWT(JSON Web Token),再到实现“一次登录,全网通行”的单点登录(SSO),认证方案随着前后端分离、微服务等架构演进不断升级。在实际应用中,开发者常需结

cmff98425的博客 418

java session iframe_解决iframe中jsessionid无法传递导致session丢失的问

在实现 ISMP2.1.1 接口的适合需要用到sso,而ISMP里定义的接口是需要在iframe等嵌入页面中调用sso接口,在实际开发中发现session无法正常传递。重现问题的场景是:test.jsp的代码为: 618119.comsso.jsp里读取传递的ssoinfo,反向调用ISMP认证接口,生成session,然后放入指定的属性值,session.setAttribute(”ssoUse...

weixin_35943776的博客 1408

JSESSIONID 在前端请求链路里的真正位置

本文探讨了在SAP Fiori开发中常见的JSESSIONID Cookie的误用问题。文章指出,JSESSIONID本质是Java Servlet容器维护会话状态的索引标识符,而非前端应主动管理的登录凭证。它作为服务端会话的路由纽带,往往与Web容器、负载均衡等基础设施深度耦合。通过分析HTTP协议无状态特性、Java Servlet会话模型及SAP各技术栈的会话机制,文章强调JSESSIONID不应存储业务数据,并解释了HttpOnly等安全属性的重要性。同时澄清了SAP UI5框架不直接处理JSESS

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1161

解决iframe嵌套URL拼接;jsessionId,每次请求sessionId不一样问题

【代码】解决iframe嵌套URL拼接;jsessionId,每次请求sessionId不一样问题。

qq_41101749的博客 1054

iframe 跨域访问session

iframe 跨域访问session问题解决方法

基于ResNet-50的猫狗分类训练

基于ResNet-50的猫狗分类python训练

weixin_46352497的博客 1007

IE下iframe跨域session和cookie失效问题的解决方案

方法概括:在iframe链接的   参考文档: IE6_7_8的差异研究 http://wenku.baidu.com/view/48fc9e18650e52ea551898c7.html IE 8 Beta 1 AJAX程序员指南 http://hi.baidu.com/getpost/item/4934dff573dea7d243c36a6a 解决iframe中jsessio

楠人的博客-随风而过 9948

STC15单片机双串口通信实战:串口2配置与多设备交互

本文详细介绍了STC15单片机双串口通信的实战配置,重点解析串口2的硬件连接、寄存器设置及多设备交互实现。通过实际项目案例和完整代码示例,帮助开发者快速掌握STC15串口2的配置技巧,解决常见通信问题,提升嵌入式系统开发效率。

weixin_29174013的博客 262

在框架中(IFRAME)传递SESSION的解决方案

<br />转载于:http://hi.baidu.com/bulebabyer/blog/item/de54230131bafade277fb5e7.html<br /> <br />在框架中(IFRAME)传递SESSION的解决方案<br />网络阅读: 一. 问题根源: <br />IE6/IE7支持的P3P(Platform for Privacy Preferences Project (P3P) specification)协议默认阻止第三方无隐私安全声明的cookie,Firefox目前还不

zgmzyr的专栏 5532

RC电路(一):微分|积分

的取值不同,会导致输出波形和输入波形之间的关系也不同,由此也会产生不同的应用。输出为0,随着电容充满电,运放-输入端得到的分压为正最大值,可等效成一个电压源,且电压不可突变,此时电流反向为最大值,开始充电时的容抗为0,电压不可突变则电压差为0,运放。开始充电时的容抗为0,电压不可突变则电压差为0,运放。输入端得到的分压也不可突变,随着电容放完电,于是。,因电容上电压不能突变(来不及充电,相当于短路,由上分析可得积分运算电路中,输出为运放的负最大峰值,随着电容充满电,输出为运放的正最大峰值,随着电容放完电,

既有随处可栖的江湖,也有追风逐梦的骁勇! 1万+

拌合楼管理软件开发(十一) 海康威视车牌识别摄像头安装调试,总算是跑通了。

/保存的文件个数这里之所以需要用到委托,直接更新textbox文本中的内容,以及复制picturebox的image会提示不是从齐创建的线程调用。

morsth的博客 4834

iframe 框架下 获取不到session 解决办法

iframe 框架在编程应用中主要用来嵌套别的网页或地址,但在使用时有时会遇到 获取不到从父页面传来的参数值情况。 [b]解决办法:[/b]拷贝下面的这段代码把它放到你的页面的头部或者你的servlet等控制类中即可。 该代码主要就是设置 http 文件头的值。 [code="java"] response.setHeader("P3P","CP=\"CURa ADMa DE...

sunshuaij2ee的博客 3336

在 ABAP Cloud 里优雅读取与解析 XML:用 sXML Reader 把接口数据落成结构化 ABAP

ABAP Cloud中XML解析实践 摘要:本文介绍了在ABAP Cloud环境下解析XML数据的最佳实践。针对企业系统中常见的XML格式数据,文章推荐使用sXML库中的CL_SXML_STRING_READER进行流式解析,而非传统的DOM方式。重点解析了命名空间(Namespace)、属性(Attribute)和CDATA等关键概念的处理方法,并比较了两种读取属性的策略:通扫所有属性(NEXT_ATTRIBUTE)和精准取值(GET_ATTRIBUTE_VALUE)。文章提供了完整的ABAP Cloud

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 205

iframe嵌套访问含Session页面,Session丢失

在网站www.a.com的页面用iframe嵌入www.b.com的页面,由于浏览器默认的安全设置,iframe内的页面的cookie不起作用,导致Session的key:jsessionid无法被获取,最终系统报Session到期的错误 临时的业务解决方案:www.a.com访问www.b.com时,直接使用link的href访问,然后在www.b.com画面增加返回www.a.com画面...

如果你真的想做一件事,你一定会找到方法; 如果你不想做一件事,你一定会找到借口。 2694

第一章:Profibus DP通信简介

PROFIBUS (Process Fieldbus)的缩写,是一种国际化的、开放的、不依赖于设备生产商的现场总线标准。它广泛应用于制造业自动化、流程工业自动化和楼宇、交通、电力等其他工业自动化领域。串行现场总线主要用来连接数字现场设备或中、低功能的系统,如传感器、执行机构、变送器、可编程序控制器(PLC)、数控装置(NC)、编程设备、本地人机接口等。

qq_22560021的博客 4910

5.17华为OD机试真题 新系统 - 输出二叉树后序遍历结果 (Java/Py/C/C++/Js/Go)

5.17华为OD机试真题 新系统 - 输出二叉树后序遍历结果 (Java/Py/C/C++/Js/Go)

算法大师! 531

ie iframe session php,IE下PHP iframe跨域导致session丢失问题的解决方法_PHP教程

一个登录页面,被别的网站用iframe嵌进去后,死活无法登录(只在IE中存在这种情况)。主要是session无法被保存的问题,下面把个人的解决过程分享个大家今天搞的一个登录页面,被别的网站用iframe嵌进去后,死活无法登录(只在IE中存在这种情况)。很明显,session无法被保存。但是直接在地址栏打开那个登录页面,一切都正常啊。真是奇怪啊。在网上搜索了一下。发现这个问题还真有不少人提及到。最后...

weixin_32797441的博客 193

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

解决 Iframe跨域session 丢失问题

解决 Iframe跨域session 丢失问题

asdfgh0077的博客 2318

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

解决Iframe中session丢失问题

 症状loadTOCNode(1, symptoms);如果别的站点要在Iframe中使用本网站的时候会发现,本网站实际上是不能保存Session的,如何被frame的页面如果像访问自己站点的Session会发现这个Session实际上是null,例如本网站上有一个登录窗口login.aspx,登录窗口登录之后就导航到index.aspx页面,index.aspx页面的访问

海的声音的专栏 3483

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

PHP关于IE的iframe跨域导致session丢失

今天搞的一个登录页面,被别的网站用iframe嵌进去后,死活无法登录(只在IE中存在这种情况)。 很明显,session无法被保存。但是直接在地址栏打开那个登录页面,一切都正常啊。真是奇怪啊。 在网上搜索了一下。发现这个问题还真有不少人提及到。最后的解决方法是在那个登录页面里加上以下代码: header('P3P: CP="ALL ADM DEV PSAi COM OUR OTRo ST

言会咸 1431

解决使用FireFox下Flash上传文件时SESSION丢失的问题(swfupload)

解决使用FireFox下Flash上传文件时SESSION丢失的问题(swfupload)   这几天在项目中遇到的问题,稍微整理一下。 HTML 表单是我们常用来进行浏览器与服务器数据交互的途径,除了传递普通的文本数据,通过 type="file"的 input 控件,我们还可以向服务器发送文件。但在目前的实际使用中,基于 HTML 表单的文件选择框有着下面两个不尽人意之处:

sbtmbj2010的专栏 3749

jsp session 丢失

1.先访问a站点:http://192.168.18.2/test.jsp test.jsp的代码为: &lt;html&gt;&lt;head&gt;&lt;title&gt; 618119.com &lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;iframe src=”http://192.168.18.3/sso.jsp?ssoinfo=xxxx“&

此情可待成追忆 442

tongweb 修改默认的jsessionID tongweb-web.xml

在使用了nginx 作为网关后,背后可能代理者 websphere ,tomcat ,tongweb等类型的各种中间件的服务,各个中间件的cookies设置可能存在差别,会导致一种问题, session 覆盖, 特别是ifame 嵌套子页面的形式,因此需要修改cookie设置 避免找不到session。对于传统使用web.xml 2.5的项目 可以使用 tongweb-web.xml设置 与项目的web.xml在同一层级。tongweb的设置项 tongweb-web.xml。

confident3的博客 525

Cookie、Session与Token:从原理到实战,彻底搞懂Web身份认证

在Web开发中,身份认证是保障系统安全与用户体验的核心机制。其基本原理在于,HTTP协议本身是无状态的,服务器需要一种方式来识别连续请求中的同一客户端。为此,衍生出了多种技术方案。Cookie作为HTTP协议的标准扩展,是浏览器存储和自动携带的小型数据片段,常用于传递会话标识。Session机制则在服务器端维护用户状态,通过Cookie传递的Session ID来关联客户端与服务器存储的数据,解决了状态管理问题,但带来了服务器存储和集群共享的挑战。随着分布式架构和前后端分离的普及,Token(特别是JWT)

weixin_30614109的博客 326

Spring Boot会话管理:从Cookie到Redis分布式Session

HTTP协议本身是无状态的,Web应用需要通过会话状态管理来记住用户身份。Session作为服务端数据仓库,依赖Cookie在浏览器与服务器间传递会话标识;而Token则以签名凭证的方式实现无状态认证。在分布式部署场景下,单机内存Session无法跨实例共享,Redis分布式会话成为主流方案。理解Session、Cookie、Token的差异,掌握Spring Boot中的会话管理、拦截器、ThreadLocal及跨域配置,能够有效解决登录状态丢失、用户串号等工程难题。本文从基础概念到实践,逐步演示从单机S

weixin_34218890的博客 304
上一篇: 郁闷的Iframe
下一篇: javascript 事件传递 的参数
xieronghua246
博客等级 码龄17年 2粉丝 115原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值