Register AccessDenialService in Riverpod provider graph
epic-no-access-screen-access-control-task-004 — Create a Riverpod provider for AccessDenialService and expose both the isRoleBlocked stream as a StreamProvider<bool> and the adminPortalUrl as a FutureProvider<String>. Register the provider in the app's provider scope so the route guard and UI can subscribe without tight coupling.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 3 - 413 tasks
Can start after Tier 2 completes
Implementation Notes
Create access_denial_providers.dart with three providers. Use ref.watch(rbacRoleProvider) inside accessDenialServiceProvider to get the role source, and ref.watch(noAccessConfigRepositoryProvider) for the config repo — this makes dependencies explicit and testable. For the StreamProvider: final isRoleBlockedProvider = StreamProvider.autoDispose
Use autoDispose on derived providers to avoid memory leaks when the no-access screen is not mounted. The route guard (task-005) will use ref.read(isRoleBlockedProvider) in the redirect callback — document this pattern in the provider file's doc comment.
Testing Requirements
Widget tests using flutter_test and riverpod's ProviderContainer for unit-level provider tests. Test scenarios: (1) isRoleBlockedProvider emits AsyncLoading then AsyncData(true) when service stream emits true, (2) adminPortalUrlProvider resolves to expected URL string, (3) provider override in ProviderScope works correctly for mocking in widget tests. Use ProviderContainer directly for non-widget provider tests. Verify no StateError thrown on provider disposal.
If the GoRouter redirect callback evaluates the no-access route itself as a blocked destination, it will trigger an infinite redirect loop, crashing the navigator.
Mitigation & Contingency
Mitigation: Add an explicit guard condition in the redirect callback: return null (no redirect) when the current location is already the no-access route or the logout route. Write a dedicated unit test covering this exact scenario.
Contingency: If the redirect loop is detected in production, deploy a hotfix that adds the null-return guard; the feature can be toggled off via the existing feature-flag infrastructure while the fix is prepared.
The access-denial-service may read role state before authentication completes (e.g. during app resume), causing a temporary false-positive block that redirects valid peer-mentor users to the no-access screen.
Mitigation & Contingency
Mitigation: Subscribe to the role-state-manager's loading/ready lifecycle and only evaluate role-based access once the RBAC state is confirmed as loaded. Return a 'pending' state that causes the guard to defer rather than redirect.
Contingency: Add a retry mechanism: if a user lands on the no-access screen but their role subsequently resolves as non-blocked, automatically navigate them to the role-based home screen.