After Framework

エンタープライズ境界

EnterpriseScope、RBAC、監査、セキュアな相互運用、ブートストラップモードについて説明します。

ドキュメントのバージョン: supercore main · パッケージ 1.0.0

EnterpriseScopeこのセクションへのリンク: EnterpriseScope

組織スコープのエンタープライズポートには EnterpriseScope が必須です。organizationId が欠けていると例外がスローされ、全テナントのデータを返すことはありません。

dart
/// Fail-closed tenant + actor context for enterprise ports (ADR-002).
class EnterpriseScope {
  final String organizationId;
  final String actorId;
  final PermissionSet permissions;

  /// Throws if [organizationId] is missing/blank — never allow all-tenant lists.
  static String requireOrganizationId(String? organizationId) {
    final id = organizationId?.trim() ?? '';
    if (id.isEmpty) {
      throw StateError(
        'EnterpriseScope: organizationId is required (fail-closed tenancy).',
      );
    }
    return id;
  }
}

ソース supercore/packages/after_enterprise/lib/src/scope/enterprise_scope.dart (新しいタブで開きます)

ADR-002 (新しいタブで開きます)

RBAC と監査このセクションへのリンク: RBAC と監査

バーティカル機能は、変更を伴う呼び出しの前に PermissionSet.allows(...) をチェックします。権限文字列は各プロダクトが独自に宣言します。

変更を伴うエンタープライズ操作はすべて、追記専用の AuditLogRepository に AuditLogEntry を追加する必要があります。

セキュアな相互運用このセクションへのリンク: セキュアな相互運用

プロダクト間の呼び出しは AfterSecureInteropBridge を経由します。After ID のオーディエンス、スコープ、RBAC、組織メンバーシップを確認した後、監査エントリを必ず記録します。

  1. After ID のオーディエンスチェック
  2. 組織が存在する場合は、スコープ、RBAC、組織メンバーシップ
  3. 監査エントリの必須記録
  4. エンドポイントスキーマによる任意のデータ最小化

ADR-006 (新しいタブで開きます)

ブートストラップモードこのセクションへのリンク: ブートストラップモード

本番モードではアダプターが欠けていると起動時に例外がスローされるため、モックプロバイダーが気付かないうちに本番環境へ入り込むことはありません。

dart
/// Composition safety mode (ADR-007).
///
/// - [scaffold]: in-memory / mock adapters are allowed (templates, tests).
/// - [production]: missing real adapters must throw at startup.
enum AfterBootstrapMode {
  scaffold,
  production,
}

ソース supercore/packages/after_core/lib/src/bootstrap/after_bootstrap_mode.dart (新しいタブで開きます)

ADR-007 (新しいタブで開きます)

エンタープライズポートこのセクションへのリンク: エンタープライズポート

実際のバックエンドは、コンポジションルートで MockEnterpriseRepository を置き換えます。OS レイヤーがベンダー名を知ることはありません。

  • EnterpriseScope
  • OrganizationRepository
  • RbacRepository
  • PermissionSet
  • WorkflowEngine
  • TaskRepository
  • CalendarRepository
  • DocumentRepository
  • EnterpriseAiAssistant
  • AuditLogRepository
  • OfflineSyncQueue
  • EnterpriseApiClient
  • MockEnterpriseRepository
  • EnterpriseProductRuntime
dart
static Future<List<Override>> ensureConfigured({
  EnterpriseRepository? enterpriseRepository,
}) async {
  PlatformConfig.current = superAppEnterpriseManifest;
  final prefs = await SharedPreferences.getInstance();
  return [
    ...AfterStandardOverrides.create(
      preferences: prefs,
      userAgent: '${superAppEnterpriseManifest.appName}/'
          '${superAppEnterpriseManifest.appId}',
    ),
    enterpriseRepositoryProvider.overrideWithValue(
      enterpriseRepository ?? MockEnterpriseRepository(),
    ),
  ];
}

ソース supercore/templates/super_app_enterprise/after_framework.dart (新しいタブで開きます)

これらは supercore リポジトリに記載されたアーキテクチャ上の制御です。After Framework は、認証取得や規制への準拠を主張するものではありません。