# Implement Anonymous Login

In 
Published 2022-12-03

This tutorial explains how you can implement anonymous login in Spring 5.

Note that there is no real conceptual difference between a user who is "anonymously authenticated" and an unauthenticated user. Spring Security’s anonymous authentication just gives you a more convenient way to configure your access-control attributes.

With Spring 5 Security you can configure the login service in order to customize it. This can be done by using anonymous() method. Using this method you can customize the default username (anonymousUser) and the default role ("ROLE_ANONYMOUS");

In order to test this customization, you have to modify the application you have obtained at the tutorial named Create Custom Login Form.

There are some little modifications to do in order to test this.

  1. Modify the Controller, for sending user information to the view:

  2. Modify the view in order to display the user information:

  3. Modify the Spring Security Configuration in order to customize the anonymous access: