asgardeo / asgardeo/javascript
feat: support for organization discovery strategies
- 主要言語
- TypeScript
- スター
- 18
- フォーク
- 67
- 平均マージ
- 4時間 6分
- マージ済み PR(30日)
- 13
説明
### Problem
Currently, Asgardeo SDK users need to manually specify the `organizationHandle` in their configuration when implementing B2B authentication flows. This creates several challenges:
1. **Manual Configuration**: Developers must hardcode organization handles or implement custom logic to extract them from URLs
2. **Limited URL Support**: No built-in support for common B2B URL patterns like:
- Path-based: `/o/{orgHandle}` or `/o/{orgId}`
- Query-based: `/?o={orgHandle}` or `/?o={orgId}`
- Subdomain-based: `{orgHandle}.example.com`
3. **Repetitive Implementation**: Each application needs to implement similar organization extraction logic
4. **Error-Prone**: Manual extraction is susceptible to bugs and inconsistencies across applications
### Proposed Solution
Implement automatic **Organization Discovery Strategies** that can extract organization handles from URLs and automatically inject them into authentication requests as `signInOptions={{ fidp: 'OrganizationSSO', orgId: '' }}`.
**URL Path Strategy** (`urlPath`):
- Extracts from patterns: `/o/{handle}`, `/o/{id}`
- Example: `https://app.com/o/acme-corp` → `acme-corp`
**URL Query Strategy** (`urlQuery`):
- Extracts from query parameters: `?o={handle}`, `?org={handle}`
- Example: `https://app.com/?o=acme-corp` → `acme-corp`
**Subdomain Strategy** (`subdomain`):
- Extracts from subdomain patterns: `{handle}.domain.com`
- Example: `https://acme-corp.app.com` → `acme-corp`
**Base URL Strategy** (`baseUrl`):
- Extracts from the configured baseUrl pattern
- Example: `baseUrl: "https://api.asgardeo.io/t/acme-corp"` → `acme-corp`
### Alternatives
_No response_
### Please select the package issue is related to
@asgardeo/express, @asgardeo/javascript
### Version
0.1.12
### Reporter Checklist
- [x] I have searched the existing issues and this is not a duplicate.
- [x] I have provided all the necessary information.
- [x] I have verified the feature on the latest version of the package.
コントリビューションガイド
調査の方向性
まず、@asgardeo/express パッケージと @asgardeo/javascript パッケージで、organizationHandle の設定と signInOptions の処理を特定します。提案されている各 URL 戦略で handle または ID をどのように抽出するべきか、また取得した値を認証リクエストにどのように渡すべきかを確認します。両方の関連パッケージで、列挙された URL パターン全体にわたって戦略が機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- express, typescript
- 領域
- authentication, backend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100