Configure Spring Security using WebSecurityConfigurerAdapter and AbstractSecurityWebApplicationInitializer

In the introduction to Spring Security, we used a configuration file and declared it with the DelegatingFilterProxy filter class to enable Spring Security for any web application. We can also do this using Java code with the WebSecurityConfigurerAdapter and AbstractSecurityWebApplicationInitializer classes, powered by Spring Security.… Read More

Configure Web Origin in Keycloak

When using Keycloak for the authentication of web applications, we will often encounter Web Origin-related errors such as “Access to XMLHttpRequest at ‘http://localhost:8080/auth/realms/huongdanjava/protocol/openid-connect/token’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.” The reason is that… Read More

Create new user in Keycloak

To use applications that use Keycloak for authentication and authorization, we need a user to log in. Usually, in large systems, the user information will be stored in Active Directory (AD) or LDAP, Keycloak can connect to these systems to retrieve user information. It can… Read More