← Java Internals explorer

Archived. This page shows content that now lives in the Spring Security Guide, section 4. It stays here so old links keep working, but it is no longer updated.

AUTHENTICATIONOne question: “Who are you?” · 9 ways to answer it1Form loginBrowser apps, your Auth ServerPlease sign inUsernamePasswordSign inUsers DBpassword hashFilterUsernamePasswordAuthentication…SpringformLogin()2HTTP BasicSimple internal APIs, toolsEvery requestGET /reportsAuthorization: Basic bml0aGluOnB3base64(user:pass)Users DBchecked each callFilterBasicAuthenticationFilterSpringhttpBasic()3Session cookieRemembers a form loginNext requestGET /accountCookie: JSESSIONID=8F2Ano password againSession storeserver-sideFilterSecurityContextHolderFilterSpringsessions (default)4JWT Bearer tokenAPIs, microservices (your A, B)API callPOST /paymentsAuthorization: Bearer eyJhbGci…signed by Auth ServerPublic keyverify signatureFilterBearerTokenAuthentication…Springoauth2ResourceServer()5OAuth2 / OIDC login“Log in with IDHub”ShopEasySign up / Log inLog in with IDHub→ ID token (JWT)IDHublogin providerFilterOAuth2LoginAuthentication…Springoauth2Login()6Client credentialsJobs, service-to-serviceToken requestPOST /oauth2/tokenclient_id: settlement-job+ client_secretAuth Serverchecks the appFilterOAuth2ClientAuthentication…SpringRegisteredClient7API keyPartner integrationsPartner callGET /ratesX-API-Key: pk_live_7Hq…no user, no expiryKey storelookup keyFilterOncePerRequestFilter (yours)Springcustom filter8mTLS / X.509 certBank-to-bank, high securityTLS handshakeClient certificate: CN=partner-bank issued by trusted CAprivate key provenTrust storetrusted CAsFilterX509AuthenticationFilterSpringx509()9MFA / OTP / PasskeySecond factor, passwordlessVerify it’s youCode sent to phone:6-digit codeVerifyFactor checkOTP or device keyFilterOneTimeToken / WebAuthnSpringwebAuthn(), 7.x MFAALL 9 END IN THE SAME PIPELINEOnly the credential and the filter change; the rest of Spring Security is identical.Credentialone of the 9 aboveAuth filterreads it from requestAuthenticationManager“who can check this?”ProviderDao / Jwt / Oidc / X509SecurityContextwho = nithin1234401 Unauthorizedwrong / missingfailsAUTHORIZATIONnext: what may they do?Remember it as:Credential → Filter → Manager → Provider → ContextFail = 401. Pass = Authorization decides (403 if not allowed).Spring Security · Security in Pictures · poster 1 of the series

Sample poster. Pinch to zoom on a phone. Next posters in the same format: Authorization, OAuth 2.0, JWT, Tokens.