Make authentication more flexible
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 42/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
首先阅读 src/authn/SolidAuthnLogic.ts 以及 pull request 171 中讨论的更改,以了解当前对 Inrupt 和 Uvdsl 的处理方式。在评估单独的 authenticator 实现和延迟加载之前,先定义面向使用者的目标选择和默认行为。完成后应在保留外部 API 的同时允许选择身份验证库,并默认使用 Uvdsl。
由索引模型根据 Issue 内容生成。
描述
When we switched out the auth lib there was an improvement suggestion from Noel:
Following up from my comments in this week's meeting, looking at the current PR it seems like src/authn/SolidAuthnLogic.ts is attempting to handle both Inrupt and Uvdsl libraries? If so, that's is good, here's a couple of comments:
I see that the Inrupt library was removed from the dependencies, but it's still used in some places using the "sessionAny". I'd strongly suggest to keep the dependency installed, and cast the variable to its actual type, rather than using any. Any should be avoided as much as possible.
The current implementation seems to rely on if/else logic inside of the same file. That is ok for now, specially if we can keep the external API for consumers the same. But ideally, we would have two different implementations of an interface, one for Inrupt and one for Uvdsl, and resolve the proper instance to use at runtime. This would also allow to add more adapters in the future. Even if that's not a goal right, it's also good for code organization. As Aad mentioned in the call, this is called the Adapter pattern. Though if that confuses you more than it helps, just take a look at how I've done it for my apps (each authentication library has its own class).
Another additional improvement is to make sure to lazy-load the authentication libraries. Basically, if someone is logging in with uvdsl, they don't need to download all the javascript of Inrupt's library. I also do that in my apps, in particular using dynamic imports (see the .lazy files).
I haven't looked at all the code in the PR, but it's not immediately clear to me how consumers of this library choose which authentication library to use. Ideally, we could have a login() function that takes an "authenticationLibrary" parameter (or "authenticator", as I call them in my code, etc.). That could default to uvdsl, but should be easy to replace with Inrupt.
- 主要语言
- TypeScript
- 星标
- 12
- 派生
- 13
- 平均合并
- 15 小时 15 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SolidOS/solid-logic 的其他 Issue
-
Migrate to Vite 未关闭
SolidOS/solid-logic#314 · 已指派 1 人 ·
-
bug
SolidOS/solid-logic#290 · 已指派 1 人 ·
-
enhancement
SolidOS/solid-logic#274 · 4 条评论 · 已指派 2 人 ·
-
难度 4/5 3-5 天 新手友好度 25/100
SolidOS/solid-logic#76 · 2 条评论 ·
-
enhancement
SolidOS/solid-logic#64 · 5 条评论 · 已指派 1 人 ·
查看 SolidOS/solid-logic 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100