AdminCsrf class
Cryptographic CSRF token manager for bloom_admin.
Implements HMAC-SHA256 based CSRF tokens bound to a server secret or session. Guarantees that state-changing admin actions (POST, PUT, DELETE) originate from authenticated and legitimate admin form submissions.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
extractToken(
BloomRequest request, [Map< String, String> ? formData]) → String? -
Extracts the CSRF token from a
BloomRequest, checking form data, headers, or query params. -
generateToken(
[String identifier = 'session']) → String - Generates a signed, opaque CSRF token for a given session / nonce identifier.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateRequest(
BloomRequest request, [Map< String, String> ? formData]) → bool -
Validates a request against CSRF attacks. Returns
trueif valid. -
verifyToken(
String? token, [String identifier = 'session']) → bool - Verifies that a submitted CSRF token is cryptographically valid and authentic.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- Cookie name containing the CSRF token.
- formFieldName → const String
- Form field key used in POST/PUT forms containing the CSRF token.
- headerName → const String
- Request header key containing the CSRF token.