Auth\Simple class creates unnecessary sessions
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- php
调研方向
从 src/SimpleSAML/Auth/Simple.php 开始,重点查看构造函数和 isAuthenticated(),然后阅读 src/SimpleSAML/Session.php 和 src/SimpleSAML/SessionHandlerPHP.php 中相关的会话处理。重现 issue 中的干净浏览器场景,并为构造 Auth\Simple 和检查身份验证添加或更新覆盖率。完成的标准是:在不存在会话时,不会创建 SimpleSAML Cookie 或新的会话文件。
由索引模型根据 Issue 内容生成。
描述
Specifics of your environment
Using SimpleSAMLphp 2.4.10-slim as an SP as documented, using default PHP sessions.
Describe the bug
The \SimpleSAML\Auth\Simple constructor creates a session even if one doesn't exist from before. This is not necessary if the class is only used to check isAuthenticated(), and causes unnecessary session files to be written on the host.
To Reproduce
$auth = new \SimpleSAML\Auth\Simple('default-sp');
if (!$auth->isAuthenticated()) {
print('<a href="/login">Login</a>');
}
With the default SimpleSAMLphp configuration.
When visiting with a clean browser (private tab), a cookie SimpleSAML is set.
Expected behavior
No cookie was set because we didn't do anything, and there was no pre-existing session.
Additional context
The documentation suggests that the session is activated upon calling isAuthenticated(), but the session is already created in the constructor, and isAuthenticated() does nothing that can trigger a session to be created.
I didn't call \SimpleSAML\Session::getSessionFromRequest()->cleanup();, as there is no previous session it wouldn't have done anything.
- 主要语言
- PHP
- 星标
- 1.1k
- 派生
- 704
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 4
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
simplesamlphp/simplesamlphp 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
simplesamlphp/simplesamlphp#2683 ·
-
难度 4/5 3-5 天 新手友好度 45/100
simplesamlphp/simplesamlphp#2674 ·
-
难度 4/5 3-5 天 新手友好度 35/100
simplesamlphp/simplesamlphp#2673 · 1 条评论 ·
-
Confirmed enhancement
难度 4/5 3-5 天 新手友好度 48/100
simplesamlphp/simplesamlphp#2664 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 72/100
simplesamlphp/simplesamlphp#2656 ·
查看 simplesamlphp/simplesamlphp 的全部 Issue
相似的 Issue
-
Bug
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/safe-publish#594 ·
-
HttpClient
难度 2/5 1-3 小时 新手友好度 75/100
symfony/symfony-docs#23092 ·
-
sync-en
难度 1/5 1 小时以内 新手友好度 90/100
-
sync-en
难度 1/5 1 小时以内 新手友好度 95/100
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 75/100