Package com.jsgalactic.axiom.security
package com.jsgalactic.axiom.security
-
ClassDescriptionTurns the credentials a request carries into a verified
SecurityIdentity.Where a request came from, as decided byTrustedProxies: the client's IP address, the scheme it used and, when a trusted proxy reported them, the host and port it addressed.The cookies of a request, parsed strictly from theCookieheader (RFC 6265bis section 4.2).Cross-origin resource sharing (the Fetch standard's CORS protocol) as global middleware, with a strict allow-list of origins.ConfiguresCors.Cross-site request forgery protection for browser clients that authenticate with cookies.BuildsCsrf; used during configuration, not thread-safe.The family of proxy headersTrustedProxiesbelieves.Replaces the values of credential-bearing headers before headers are logged.ASessionStorein process memory with idle and absolute timeouts and a hard bound on the number of sessions.BuildsInMemorySessionStores; used during configuration, not thread-safe.Rate limiting middleware: at most a number of requests per window for each key, with memory that stays bounded however many distinct keys arrive.The counting algorithm.BuildsRateLimits; not thread-safe, used during configuration.The outcome of counting one request.Chooses the key a request is counted under byRateLimit: one budget per distinct key.Authentication and authorization policies asMiddleware, bound to oneAuthenticator.Middleware that adds secure default response headers for an HTTP API.One request's view of its session, fromSessions.session(com.jsgalactic.axiom.context.Context).AnAuthenticatorthat reads the identity from the request's session, so the policies ofSecuritywork for cookie-authenticated browsers exactly as for bearer tokens.Server-side sessions as middleware: a cookie carries a random secret identifier, aSessionStoreholds everything else.BuildsSessions; used during configuration, not thread-safe.The data aSessionStorekeeps for one session: who is signed in, application attributes and two timestamps.WhereSessionskeep session data, keyed by the secret session identifier.ASet-Cookieheader with secure defaults, validated when it is created.TheSameSiteattribute.Decides a request's client address and scheme, believingX-Forwarded-ForandX-Forwarded-Protoonly when they were set by configured, trusted proxies.