Reputation: 35719
both spring authentication provider and authentication processing filter also need to register with authenticationManager?
authentication provider i can use custom-authentication-provider tag
but what is different spring authentication provider and authentication processing filter ?
Upvotes: 23
Views: 11099
Reputation: 1195
According to Spring Security Architecture the process is:
See an example here: a filter is calling a provider manager to find a provider who supports this authentication and if so the do authenticate
Here you can find a nice example on how to implement a custom filter: Custom filter @Baeldung
Please consider that filters are calling Provider Managers or Providers only if they are coded like that. There's no rule to enforce that.
Upvotes: 20
Reputation: 1317
The authentication manager uses all authentication providers to authenticate authenticationtokens it has to authenticate.
The authentication processing filter just adds a token (username password). Other filters add tokens too. For example the AnonymousProcessingFilter.
The idea is to seperate token generation from token authentication. That way you could implement stuff like authentication against multiple sources easily.
The regular case is one provider per token generator.
Upvotes: 18