Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
package com.codename1.backend.security
Authentication and authorization for the routes of a backend, in the shape
of Spring Security: an application declares one or more
SecurityFilterChain beans, each built from
the HttpSecurity its method is handed, and
every request the server does not answer on its own behalf is put to them.
A server with no such bean links none of this.
Types
class AbstractAuthenticationToken | The parts every Authentication shares: its authorities, its details and the name read off its principal. |
class AccessDeniedException | The caller may not do what it asked. |
interface AccessDeniedHandler | Answers a signed-in caller that asked for something it may not have. |
class AccessDeniedHandlerImpl | Answers 403. |
class AccountExpiredException | The account has expired. |
class AccountStatusException | The account exists and may not be used as it stands: locked, disabled or expired. |
class AnonymousAuthenticationFilter | Gives a request nobody signed in for an AnonymousAuthenticationToken, so the rules that follow always have an authentication to judge. |
class AnonymousAuthenticationToken | Who a request is from when nobody signed in: a principal called anonymousUser holding ROLE_ANONYMOUS, so authorization rules always have someone to ask about. |
class AnonymousConfigurer | The authentication of a request nobody signed in for; see AnonymousAuthenticationToken. |
class AntPathRequestMatcher | Matches a request’s path against an Ant-style pattern, and optionally its method. |
class AnyRequestMatcher | Matches every request. |
class ApiKeyAuthenticationFilter | Authenticates a request from the API key it presents, in X-API-Key or as Authorization: Bearer <key>. |
class ApiKeyConfigurer | Sign-in with an API key on each request. |
class AuthenticatedAuthorizationManager | Grants access by whether the caller signed in at all. |
interface Authentication | Who a request is from: a credential presented for checking, or – once an AuthenticationManager has accepted it – the principal and what it may do. |
interface AuthenticationCodec | Keeps one kind of Authentication in the HTTP session, and makes it again on the next request. |
interface AuthenticationEntryPoint | Answers a request that has to authenticate first: with a challenge, or a redirect to where the user signs in. |
class AuthenticationException | The request could not be authenticated. |
interface AuthenticationFailureHandler | Answers a sign-in that was refused. |
interface AuthenticationManager | Decides whether a presented Authentication is genuine. |
interface AuthenticationManagerResolver | Chooses what authenticates a request, by the request: a server with several tenants, or tokens from several issuers. |
interface AuthenticationProvider | One way of checking an Authentication: a ProviderManager asks each of its providers that supports the token’s class. |
class AuthenticationServiceException | Authentication could not be attempted at all: the user store failed, or the layer is misconfigured. |
interface AuthenticationSuccessHandler | Answers the request that signed a user in. |
class AuthorityAuthorizationDecision | A decision that turned on what the caller is granted, with the authorities any one of which would have done. |
class AuthorityAuthorizationManager | Grants access to an authenticated caller holding one of a set of authorities. |
class AuthorizationDecision | Granted, or not. |
class AuthorizationFilter | Puts the request to the chain’s authorization rules, and throws AccessDeniedException when they refuse it. |
interface AuthorizationManager | Decides whether an authentication may reach something: for a request rule, a RequestAuthorizationContext. |
class AuthorizationServerConfigurer | Makes the server an OAuth2 authorization server and OpenID Connect provider. |
class AuthorizeHttpRequestsConfigurer | The authorization rules of a chain: which requests need what. |
class BadCredentialsException | The credentials are wrong: an unknown user or a password that does not match. |
class BasicAuthenticationEntryPoint | Answers 401 with the challenge that makes a client send HTTP Basic credentials: WWW-Authenticate: Basic realm="Realm". |
class BasicAuthenticationFilter | Authenticates a request from its Authorization: Basic header. |
class BearerTokenAuthenticationFilter | Authenticates a request from its bearer token. |
interface Clock | Where the parts of the layer that judge time – a token’s expiry, a rate limit’s window – read it from, so a test can move it. |
class CookieCsrfTokenRepository | Keeps the token in a cookie, XSRF-TOKEN, for a page whose script reads the cookie and sends its value back in the X-XSRF-TOKEN header – the convention Angular and axios follow. |
class CredentialsExpiredException | The password was right and has expired. |
class CsrfConfigurer | Protection against cross-site request forgery. |
class CsrfException | A state-changing request did not prove it came from the application’s own pages. |
class CsrfFilter | Refuses a state-changing request that does not carry the chain’s CSRF token. |
interface CsrfToken | The token a page sends back with a state-changing request to show the request came from the application’s own pages. |
interface CsrfTokenRepository | Where a chain keeps the CSRF token it expects a client to send back. |
interface Customizer | Configures one part of an HttpSecurity: the lambda handed to formLogin, csrf, authorizeHttpRequests and the rest. |
class DaoAuthenticationProvider | Checks a username and password against a UserDetailsService: loads the user, compares the password through a PasswordEncoder, and refuses an account that is locked, disabled or expired. |
class DefaultCsrfToken | A CsrfToken that is its three values. |
class DefaultLoginPageGeneratingFilter | Serves a plain login page at GET /login for a chain that uses form login and names no page of its own. |
class DefaultSecurityFilterChain | A SecurityFilterChain that is a matcher and a list of filters: what HttpSecurity.build returns. |
class DisabledException | The account is disabled. |
class ExceptionHandlingConfigurer | How a chain answers a request that must sign in, and one that may not have what it asked for. |
class ExceptionTranslationFilter | Turns the security exceptions thrown by what follows it – the authorization rules, a controller, a service the controller calls – into answers. |
interface FilterChain | The rest of the chain, as a SecurityFilter sees it: the filters after it and then the application’s routes. |
class FormLoginConfigurer | Sign-in through an HTML form. |
interface GrantedAuthority | One thing an Authentication has been granted: a role, written ROLE_ADMIN, or any other authority the application checks by name. |
interface HeaderWriter | Writes a header onto every response a chain’s requests get: |
class HeaderWriterFilter | Holds the chain’s HeaderWriters. |
class HeadersConfigurer | The security headers a chain puts on its responses. |
class Http403ForbiddenEntryPoint | Answers 403: what a chain with no way of signing in says to a request that would have to. |
class HttpBasicConfigurer | Sign-in with HTTP Basic credentials on each request. |
class HttpSecurity | Builds one SecurityFilterChain. |
class HttpSessionCsrfTokenRepository | Keeps the token in the HTTP session: the default. |
class HttpSessionRequestCache | Remembers the address in the HTTP session, under SAVED_REQUEST. |
class HttpSessionSecurityContextRepository | Keeps who is signed in in the HTTP session, under SPRING_SECURITY_CONTEXT_KEY. |
class HttpStatusEntryPoint | Answers with a status and nothing else: new HttpStatusEntryPoint(401) for an API whose clients know how to authenticate without being told. |
class HttpStatusReturningLogoutSuccessHandler | After sign-out, answers with a status and no page: for an API. |
class InsufficientAuthenticationException | The request is anonymous, or not authenticated strongly enough, for what it asked for. |
class InvalidCsrfTokenException | The request’s CSRF token is not the one the server issued. |
class LockedException | The account is locked. |
class LoginUrlAuthenticationEntryPoint | Sends a request that has to sign in to the login page, with a 302. |
class LogoutConfigurer | Sign-out: POST /logout ends the session, forgets who was signed in and redirects to /login?logout. |
class LogoutFilter | Signs the user out when a request asks for it – POST /logout unless configured otherwise – and answers with the chain’s LogoutSuccessHandler. |
interface LogoutHandler | Something to undo when a user signs out: a session, a cookie, a stored token. |
interface LogoutSuccessHandler | Answers the request that signed a user out. |
class MfaConfigurer | A second factor at sign-in. |
class MissingCsrfTokenException | The request carried a CSRF token and the server holds none to compare it with – the session it belonged to is gone – or carried none at all. |
class NullRequestCache | Remembers nothing. |
class NullSecurityContextRepository | Keeps nothing: every request authenticates itself. |
class OAuth2AuthorizationEndpointFilter | Answers the endpoints of an authorization server a user must be signed in for: the authorization endpoint and the device verification page. |
class OAuth2AuthorizationRequestRedirectFilter | Starts a sign-in at an identity provider: keeps the request this browser is sent away with, and redirects it to the provider. |
class OAuth2AuthorizationServerFilter | Answers the endpoints of an authorization server that a client calls as itself: the token, revocation, device authorization, JWK Set, user info and metadata endpoints. |
class OAuth2LoginAuthenticationFilter | Ends a sign-in at an identity provider: takes the provider’s answer at /login/oauth2/code/{registrationId}, holds it to the request this browser was sent away with, exchanges the code, verifies the ID token and signs the user in. |
class OAuth2LoginConfigurer | Sign-in through another identity provider, with OAuth2 or OpenID Connect. |
class OAuth2ResourceServerConfigurer | Sign-in with a bearer token on each request: the routes under the chain are an OAuth 2.0 resource server, and the token is a JWT. |
class ProviderManager | An AuthenticationManager that asks a list of AuthenticationProviders in order and takes the first answer. |
class ProviderNotFoundException | No AuthenticationProvider of a ProviderManager checks tokens of the class it was handed. |
class RateLimitConfigurer | The rate limits of a chain; filled in by HttpSecurity.rateLimit. |
class RateLimitFilter | Answers 429 to a request that is over one of the chain’s rate limits; see HttpSecurity.rateLimit. |
class RememberMeAuthenticationFilter | Recognizes a returning user by their remember-me cookie, on a request nobody has signed in for. |
class RememberMeAuthenticationToken | Who a request is from when the user was recognized by a remember-me cookie rather than signing in during this session. |
class RememberMeConfigurer | Remember-me: a cookie that signs a returning user in. |
class RequestAuthorizationContext | What a request rule is asked about: the request, and the variables its pattern bound. |
interface RequestCache | Remembers where an anonymous request was going, so that signing in can send the user there instead of to a fixed page. |
class RequestCacheConfigurer | Whether a chain remembers where an anonymous request was going; see RequestCache. |
interface RequestMatcher | Decides whether a rule applies to a request: which chain guards it, which authorization rule covers it, which requests CSRF protection leaves alone. |
class RequestMatchers | Combines matchers: all of them, any of them, or not one. |
class SavedRequestAwareAuthenticationSuccessHandler | After sign-in, sends the user to the page that asked them to sign in, or to a default when they came to the login page on their own. |
class SecondFactorAuthenticationFilter | Asks a user who has a second factor for it, between their password being accepted and their being signed in. |
interface SecondFactorPolicy | Stands between a user passing their first factor and being signed in. |
class SecurityConfigurer | One configurable part of an HttpSecurity: form login, CSRF protection, the authorization rules. |
interface SecurityContext | What the security layer knows about the thread’s current request: who it is from. |
class SecurityContextConfigurer | Where a chain keeps who is signed in between requests. |
class SecurityContextHolder | Who the calling thread’s request is from. |
class SecurityContextHolderFilter | Loads who is signed in from the chain’s SecurityContextRepository into SecurityContextHolder before anything else looks. |
class SecurityContextImpl | A SecurityContext that holds its authentication and nothing else. |
interface SecurityContextRepository | Where a chain keeps who is signed in between one request and the next. |
class SecurityExchange | What a chain keeps about the request the calling thread is serving, beyond the request itself: attributes filters hand one another, and headers for the response that is yet to come back. |
interface SecurityFilter | One step of a SecurityFilterChain. |
interface SecurityFilterChain | The filters that guard some of a server’s requests. |
class SecuritySchema | The tables the security layer’s database-backed stores keep, as a migration set of the layer’s own. |
class ServiceBusyException | The server is doing as much of something expensive as it was told it may, and this request would have been one more: it is turned away at once, rather than queued behind work that is already late. |
enum SessionCreationPolicy | Whether a chain may use the HTTP session. |
class SessionManagementConfigurer | Whether a chain uses the HTTP session, and what happens to it at sign-in. |
class SessionSignIn | How a chain signs a user in to a session, once some mechanism has established who they are. |
class SimpleGrantedAuthority | An authority that is its name and nothing else. |
class SimpleUrlAuthenticationFailureHandler | After a refused sign-in, sends the user to a page – the login page with ?error, usually – or, with no page set, answers 401. |
class SimpleUrlLogoutSuccessHandler | After sign-out, sends the user to a page. |
class UsernamePasswordAuthenticationFilter | Signs a user in from the login form: a POST to the login processing URL carrying username and password. |
class UsernamePasswordAuthenticationToken | A username and password: as a client presented them, or – with authorities – as an AuthenticationProvider accepted them. |
class WebAuthnAuthenticationFilter | Signs a user in with a passkey: hands out the options of a sign-in at POST /webauthn/authenticate/options, and takes the authenticator’s answer at POST /login/webauthn. |
class WebAuthnConfigurer | Passkeys: a user who is signed in registers one, and from then on signs in with it. |
class WebAuthnRegistrationFilter | Lets a signed-in user register a passkey, and remove one of theirs: |