But now let's discuss the definition of authentication provider so we know that as an interface and
how to implement it if we want to define our own authentication logic.
But let's try to understand what different methods available inside it that we have to override.
It's very simple.
It has only two methods.
One is a Pentecostal method which accept authentication parameter and returns the same authentication
parameter.
If you can recollect in the architecture of the spring security, the filters that intercept the history
episode, that request will convert them into an authentication object and call the authentication manager
authentication manager in Danville, call authentication method inside this provider.
So if you want to write all the logic that you want to perform to the user, so authenticate is the
matter where you have to write.
And there is one more important method, which is support method.
The purpose of this method is, as we were discussing previously, your organization may have multiple
ways of authentication.
You use it like username credentials, fingerprint face recognition.
So this support method will help which type of authentication format that this provider supports.
Suppose if I'm implementing it authentication provider for detecting it, face recognition of the user,
then I will.
How inside this supports method that this entire authentication provider has to be called only in the
scenarios where we are doing facial recognition from the user, but not using username and password.
So that's the purpose of support.
So now we have what is a definition of authentication provider.
Let's try to understand in the code of the spring security framework, right.
From authentication manager to authentication provider, one by one.
This is the authentication manager available inside the spring security framework.
And there is only one method which is similar to what we have seen in the authentication provider,
because it is making sense, right?
It has to pass the same request that it is coming from the filter to the provider, which will actually
validate the controls of the user.
So this manager job is only to identify and call all the providers present inside my application one
by one, till that the user is authenticated successfully.
Or once we try to all the providers, then we should throw an exception.
So that's the only responsibility of the authentication manager.
That's why we have the same method present inside this also similar to provider.
And the only difference between the manager and provider is support Smith.
As you can expect, authentication provider is the one which does actual authentication logic.
That's why it needs that support method in the scenarios where we want to have multiple ways of authentication.
But there'll be only a single authentication manager which will always delegate the authentication object
to the corresponding providers.
So now this is the interface you might be asking like what is the implementation of this authentication
method?
So provider manager is the implementation of the authentication mechanism.
So here is an authenticate method which my friends will call.
And inside this ATM it will look what role the provider support by my application like.
And we have three providers.
One is username credentials, the other one is fingerprints that Ronni's or so it will try to loop one
by one inside a for loop.
And the very first check that it will do is whatever authentication type that I'm getting.
Is it supported by this provider?
I suppose I may.
How three authentication implementations inside my application.
One is username authentication, the other one is a fingerprint authentication, and the last one is
authentication.
So here I can mention inside my provider what is the type that my provider supports.
So if it supports the Nunley, it will continue to the next logic.
Otherwise it will skip this all the next logic and it will go and check for that next provider.
So this is the way my authentication manager, which is provider manager here, because it implemented
authentication manager, it trace all the providers available inside our application.
And first it will call whether the provider that is right now focusing.
It supports the authentication date next, it will call the authentication method, which is available
in the authentication provider implementation.
So if the result is not null, it will come out of the loop because that means my framework identify
the correct provider that needs to be executed.
But if the result is null, then it will go on to other providers.
And you can also see one of the great future provided by security and said provider manager.
Once everything, all authentication is completed, it will erase your credentials and sensitive data
like password because the authentication is complete.
There is no need to maintain that password again in the authentication object or in any other place
because it will create a mystery security force that is also taken care of.
Insert the spring security.
So now we know what is provider manager and how we call provider one by one and how it VALETTA authentication.
Oh, let's try to go.
The authentication provider that we are discussing.
It is an interface which has only two methods.
One is authenticate where we have to write our own logic and followed by the supports.
So this is the important method to define which provider has to be called for.
The input that I am receiving from the user and previous leave and we are building the application.
We never implemented authentication provider, but Spring Framework provided a default implemented authentication
provider, which is a davo authentication provider.
So this extends abstract user details, integration provide.
The insight is provided.
We have an authenticated method which will be called the authentication manager, our program manager.
With this, I'm assuming your understanding what is authentication provider, how to leverage the how
to implement it, espero requirements.
We will be doing some handsome exercise in the coming videos.
But before going to the hands on, I just wanted to show you what is this authentication interface and
what is the importance of it in this being security framework.
So let's try to look into that in the next room.
Thank you.
And by.