Spring Security(Third Edition)
上QQ阅读APP看书,第一时间看更新

Authenticating with different parameters

One of the strengths of AuthenticationProvider is that it can authenticate with any parameters you wish. For example, maybe your application uses a random identifier for authentication, or perhaps it is a multitenant application and requires a username, password, and domain. In the following section, we will update CalendarUserAuthenticationProvider to support multiple domains.

A domain is a way to scope our users. For example, if we deploy our application once but have multiple clients using the same deployment, each client may want a user with the username admin. By adding a domain to our user object, we can ensure that each user is distinct and still supports this requirement.