Spring Security

Related Tags

Tutorials

Diagram of a client getting a JWT from the authorization server on port 9000 and calling the resource server on port 8082, which fetches the public keys from /oauth2/jwks

Spring Authorization Server Tutorial (Spring Boot 4)

Spring Authorization Server issues OAuth2 access tokens and OpenID Connect ID tokens from our own Spring Boot application. This tutorial builds an authorization server and a resource server on Spring Boot 4.1, with client_credentials and PKCE clients, key rotation, custom claims, JDBC client storage, MockMvc tests and real curl output.

Spring Security 7: What’s New and How to Migrate From 6.x

Spring Security 7 ships with Spring Boot 4 and removes the APIs deprecated in 6.x, such as and() chaining and AntPathRequestMatcher. This overview lists every change in one table, explains each one briefly with snippets for the main ones, and ends with a migration checklist from 6.x.

Spring Boot Role-Based Authentication with AWS Cognito

Spring Security framework supports a wide range of authentication models, and in this tutorial, we will cover OAuth2 authentication using Amazon Cognito. We will walk through a step-by-step guide from creating the user pool in the AWS, adding the app client, and configuring it in the Spring Boot application. 1. …

WebSecurityConfigurerAdapter Deprecated: Migration Guide

WebSecurityConfigurerAdapter was deprecated in Spring Security 5.7 and removed in 6.0. Replace it with a SecurityFilterChain bean, requestMatchers, a PasswordEncoder bean, WebSecurityCustomizer and @EnableMethodSecurity on Spring Boot 4, with tests.

Spring Security Context Propagation to Threads

Learn to pass the Spring SecurityContext instance to new threads either spawned by Spring @Async or created explicitly using new Runnable or Callable instances. 1. Default Strategy is ThreadLocal Once the AuthenticationManager completes the authentication process successfully, it stores the Authentication instance for the rest of the request in the …

Password Encoders in Spring Security

Learn the contract spring security expects from PasswordEncoder interface, inbuilt implementations and DelegatingPasswordEncoder with examples.

Spring Custom Token Authentication Example

Learn to add custom token based authentication to REST APIs using created with Spring REST and Spring security 5. In given example, a request with header name “AUTH_API_KEY” with a predefined value will pass through. All other requests will return HTTP 403 response.

Spring Method Security with Protect-Pointcut

Spring Method Security with Protect-Pointcut is a mechanism to apply security at the method level based on AOP-style expressions (pointcuts). This allows the Spring security configuration to be segregated from the application code.

Spring Security Siteminder Pre-authentication Example

So far we have learned about securing spring application using login form based security, custom user details security and many more such security related concepts. In this post, I am giving an example of scenario where use is already authenticated via any third party application or tool e.g. site minder …

Spring View Layer Security using JSP Taglibs

So far in previous tutorials, we have learned about securing your application behind login form, custom user detail service and even method level security also. All these security implementations were on controller or model layer of MVC. Its time to add security in view layer. It is mostly needed when …

Spring Method Security with @PreAuthorize and @Secured

Spring framework has made securing your application so much easy that you only need to use some basic configurations CORRECTLY, and that’s it !! This security can be applied to multiple levels in your web application. Spring’s basic support is for these levels: URL level security Method level security Entity …

Basic Auth with Spring Security

Learn about default basic authentication commissioned by Spring security and customize its configurations such as password encodings.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.