In the previous videos, we have seen two types of customizations that we have done.
One is going with whatever springs security is provided by default, where the spring security expert,
each and every request coming towards it has to be checked for security credentials.
Later on, we customized it for the Aspell custom requirements by making four parts as a code and remaining
two parts as nonsecular.
Now think of a scenario where we may have to be denying all the requests coming to our back and for
whatever reason.
So one of the reasons that I can think of is like you may have some peculiar business requirements that
my server should not accept any requests, even though they have proper credentials as associated said
to them during some midnight time or some particular timeframe.
So in such scenarios, Spring Security also provided a feature of denying all the requests.
Whether they have a proper authentication details or not, it will still deny all the subsequent request
that is coming towards the.
Let's try to see how to do that.
For reference, I just put the first default configuration here with the default configurations, which
will secure all the request.
So here, if you see we are seeing any request has to be authenticated for all the form login and based
later on, what we have done is we customize that accord by using and matches associated for each part,
like my account, my balance, my loans, my cards with all this for has to be authenticated, followed
by notices and contact bot astrobee nonsecure where everyone can access it.
Now, as I was saying, we should deny all the requests that is coming towards our back backend in such
scenarios.
What we have to do is let me try to copy paste the same quote from the default framework for now, instead
of authenticated, we should deny all that means this scenario, a request that comes towards my spring
security backend services.
It will deny all of them, regardless whether they are authenticated, user or not.
I'm saving this or starting this over using on the job application.
The server is already started.
Let me go and kill the previous one.
No, I'm starting again this time my service.
Eighty, eighty.
Let's try to go and test in the basement.
Now, we have done the configurations to deny all the request that comes towards Bakan application,
let's try to test the same in this Posman.
So now I'm trying to call my cards with get to type.
And I also provided authorization details.
And if you try to send the request now, we should get four billion error.
That means whatever you're trying to pawn, it is denying.
The reason is we Ausdance bring security specifically not to process any requests, deny everything
that comes.
So that's why in this scenario, we get forward and think of a scenario where we want to try without
credentials.
And if I try to call again, even I get the forbidden error.
That means spring security framework is not violating or not looking at my credentials at all.
It's always giving a forbidden error, saying that this part is not allowed to call and that's why we
are getting it for zero three.
So this is the way how we should deny all the requests.
In the next video, we'll try to see how to accept every request without authorization.
So that will also be comfortable doing the changes in our application whenever a situation occurs.
Thank you by.