Differences from Spring

Spring Security logs browsers in on a server. Java has no apps, so most of this package has no counterpart: the app's own login, the secure storage, the login window, DPoP on the client. Where Spring has something (the registrations, the authentication events, @PreAuthorize, the SecurityContextHolder), the package uses Spring's names and types.

Why

Knowing which parts are Spring's helps you share code and configuration with a Spring server, and tells you which guarantees hold where.

Example

The same registration in a Spring Boot server and in an app:

# A Spring Boot server: a confidential client with a secret, oauth2Login()
spring.security.oauth2.client.registration.keycloak:
  client-id: neon-server
  client-secret: ${KEYCLOAK_SECRET}
  scope: openid,profile,email
# An app: a public client, no secret, PKCE, its own redirect
spring.security.oauth2.client.registration.keycloak:
  client-id: neon-app
  scope: openid,profile,email
  redirect-uri: dev.neon.books:/oauth2/callback

Differences

Spring Security Here
oauth2Login() on a server, a confidential client, tokens in the session OAuth2LoginService on the device, a public client with PKCE, tokens in the secure storage
The browser follows redirects The system's login window (Safari sheet, Custom Tab, the default browser with a loopback redirect)
No browser side for a server login ServerOAuth2LoginService: the same login / restore / logout in a browser, with a user endpoint and a CSRF cookie
DPoP accepted on resource servers only (Spring Security 7) DPoP on the client, with a key in the Secure Enclave or the Keystore
@PreAuthorize protects a method on the server @PreAuthorize on a screen or a bean of the app hides it on the device; the server must still check
Thymeleaf's sec:authorize PrincipalView, PrincipalBuilder, context.principal
The default login page LoginForm, OAuth2LoginButton and the brand buttons
Spring Vault's VaultTemplate SecretTemplate, on the device's secure storage
spring-security-test's @WithMockUser withMockUser of testing.dart
The ID token's signature is checked Not checked when it comes straight from the token endpoint over TLS (OpenID Connect Core §3.1.3.7); an OidcIdTokenDecoder bean checks it. Sign in with Apple's token, which comes from the system, is always checked

Limits

See also