fhir_auth library
SMART on FHIR authentication for Flutter apps.
Everything in the pure-Dart fhir_auth_core, plus the parts that need
Flutter: the pop-up / system-browser sign-in (WebAuthenticator), native
phone sign-in (MobileAuthenticator), Keychain/Keystore token storage
(SecureTokenStorage), and a SmartFhirClient that uses the first and
the last when you name no others.
Classes
- AuditEvent
- Represents an audit event
- AuditEventStore
- Interface for audit event storage
- AuditLogger
- Audit logger for security events
- AuthConfig
- Base configuration for FHIR authentication
- AuthenticationResult
- Result of an authentication attempt
- Authenticator
- Abstract interface for platform-specific authentication
- AuthState
- Represents stored authentication state
- BackendServiceConfig
- Backend service configuration
- BrowserWindow
- The browser window the app runs in: its address, navigation, and session storage.
- ContentTypes
- Content types
- FhirAuthClient
- Base class for authenticated FHIR HTTP clients
- HttpHeaders
- HTTP header names
- InMemoryAuditStore
- In-memory audit event store (for development/testing)
- JwtClaims
- Represents a JWT token's claims
- JwtValidator
- JWT validator for secure token verification with JWK/JWKS support
- KeyValueStore
- A string-to-string store with synchronous reads and writes.
- MemoryKeyValueStore
- A KeyValueStore held in memory, for tests and non-browser platforms.
- MobileFullFlowAuthenticator
- Mobile authenticator for full OAuth flow using native AppAuth
- OAuthFlow
- Manages OAuth 2.0 authorization code flow
- OAuthParameters
- OAuth 2.0 parameters
- PendingRedirectLogin
- The secrets of an authorization request whose answer has not come back.
- PkceManager
- PKCE generator for OAuth 2.0 authorization code flow
- PkceParameters
- PKCE parameters for storage/transfer
- RateLimitConfig
- Rate limit configuration
- RateLimiter
- Rate limiter using sliding window algorithm
- RateLimiterRegistry
- Global rate limiter registry for different endpoints
- RedirectTabRecord
-
The record one browser tab's same-window login keeps in session storage,
under a key made from the login's OAuth
state. - SecureTokenStorage
- Secure implementation of token storage using flutter_secure_storage
- Session
- Represents an active user session
- SessionConfig
- Session timeout configuration
- SessionManager
- Session manager with automatic timeout
- SmartConfig
- SMART on FHIR specific configuration
- SmartFhirClient
- SMART on FHIR client for OAuth authentication.
- SmartTokenResponse
- Represents OAuth 2.0 tokens and associated SMART on FHIR metadata
- StateManager
- Manages state and nonce parameters for OAuth security
- StorageKeys
- Storage keys for secure storage
- TabTokenStorage
- Keeps one tab's tokens in a KeyValueStore, under keys that carry tabKey.
- TokenExpiryBuffer
- Token expiry buffer times
- TokenIntrospectionResult
- Result of token introspection
- TokenIntrospector
- Client for token introspection (RFC 7662)
- TokenStorage
- Where a client keeps its tokens and authentication state.
- UserAgent
- User agent for HTTP requests
- WebAuthenticator
- Web authenticator using flutter_web_auth_2
Enums
- AuditEventType
- Categories of security events recorded in the HIPAA audit trail.
- AuditSeverity
- Severity level for audit events
- ClientAuthMethod
- Client authentication methods
- CodeChallengeMethod
- PKCE code challenge methods
- ContextType
- SMART on FHIR context types
- GrantType
- OAuth 2.0 grant types
- JwtAlgorithm
- JWT signing algorithms
- LaunchType
- SMART on FHIR launch types
- ResponseType
- OAuth 2.0 response types
- SecurityViolationType
- Types of security violations
- SmartCapability
- SMART on FHIR capabilities
- TimeoutReason
- Session timeout reason
- TokenType
- Token types
Functions
-
assertSecureAuthUrl(
Uri uri, {required String field, bool allowInsecure = false}) → void -
Throws a SecurityException unless
uriis a secure OAuth/OIDC endpoint. -
constantTimeEquals(
String a, String b) → bool - Compares two strings in constant time relative to their content.
-
currentBrowserWindow(
) → BrowserWindow - The window the app runs in. Throws UnsupportedError here: this build is not for the web, so there is no browser window.
-
isSecureAuthUrl(
Uri uri) → bool -
Whether
uriis safe to use for an OAuth/OIDC network call.
Typedefs
- SmartFhirClientFactory = SmartFhirClient Function({AuditLogger? auditLogger, required AuthConfig config, Client? httpClient, Logger? logger, SessionManager? sessionManager, required TokenStorage tokenStorage})
-
Builds the client that
SmartFhirClient.completeRedirectLoginreturns, so a package that extendsSmartFhirClientgets its own type back.
Exceptions / Errors
- AuthenticationException
- Exception thrown when authentication fails
- AuthorizationException
- Exception thrown when authorization fails
- ConfigurationException
- Exception thrown when configuration is invalid
- FhirAuthException
- Base class for all authentication-related exceptions
- NetworkException
- Exception thrown when network operations fail
- PlatformAuthenticationException
- Exception thrown when authentication fails at the platform level
- ProviderException
- Exception thrown when provider-specific issues occur
- RateLimitException
- Rate limit exceeded exception
- SecurityException
- Exception thrown for security violations
- SmartLaunchException
- Exception thrown when SMART launch fails
- StorageException
- Exception thrown when storage operations fail
- TokenException
- Exception thrown when token operations fail