A credential is information used to verify a user’s identity, such as a username and password. In a web login, the form sends these values with an HTTP request so the application can check them. section 9.1
A Spring login example stores the submitted username and password in a request-scoped bean, limiting their lifetime to that request. Its credentials are hard-coded for demonstration; real applications store users in a database and encrypt passwords. Use Spring Security for production authentication and authorization rather than implementing them yourself. section 9.1
Login form
The example form asks for a username and password. A controller passes the submitted values to a login processor, which checks them and returns a success or failure result. section 9.1
Figure 9.1 We’ll implement the login functionality in three steps. For each step we implement, we’ll need to use a different bean scope. We use a request-scoped bean to implement the login logic without risking storing the credentials for longer than the login request. We’ll then decide what details we need to store for the authenticated user in a session-scoped bean. Finally, we’ll implement a feature to count all the login requests, and we’ll use an application-scoped bean to keep the number.

Shows how login credentials are kept for the request, before authenticated-user details are handled in session scope. section 9.1









