1 00:00:00,150 --> 00:00:06,720 In this section, we will discuss a lot about method level security, which is an extra feature provided 2 00:00:06,720 --> 00:00:08,420 by the spring security framework. 3 00:00:08,610 --> 00:00:18,240 So as of now, we have applied authorization rules on top of our airports, like slashed lawns account. 4 00:00:18,240 --> 00:00:24,360 So we apply like who and what authorities they should be able to access those parts. 5 00:00:24,660 --> 00:00:32,640 It might be NVC parts are WIPA parts, but there might be a requirement in your application that you 6 00:00:32,640 --> 00:00:37,080 want to bring this Australian rules to different layers of your application. 7 00:00:37,110 --> 00:00:44,560 Like I want to put certain authorization rules, like who can execute the method in my service layer 8 00:00:44,610 --> 00:00:48,770 or repository layer or any layer that your application has. 9 00:00:48,780 --> 00:00:54,360 And at the same time, there is no guarantee that all the time the applications that you are going to 10 00:00:54,360 --> 00:00:57,560 be will be Web applications. 11 00:00:57,570 --> 00:01:03,740 There might be a scenario where you have non Web applications where you will not have any iPads are 12 00:01:03,740 --> 00:01:07,680 emissive parts to configure attribution rules for altered scenarios. 13 00:01:07,890 --> 00:01:11,990 Metal level security is the answer from spring security. 14 00:01:12,000 --> 00:01:20,930 So this feature will help us in implementing authorization rules on top of methods inside our application. 15 00:01:21,210 --> 00:01:27,600 The very first step that we have to take it in order to enable the metal level security is to use the 16 00:01:27,600 --> 00:01:34,530 annotation update, enable global security on any of the configuration class, which has an annotation 17 00:01:34,530 --> 00:01:35,790 under IT configuration. 18 00:01:35,970 --> 00:01:42,810 So metal level security provides to a protest in order to apply any alteration rules on top of your 19 00:01:42,810 --> 00:01:43,290 methods. 20 00:01:43,650 --> 00:01:51,330 One is invocation authorization like based upon the rules that you configure, the spring security framework 21 00:01:51,330 --> 00:01:55,260 will decide whether this method has to be invoked or not. 22 00:01:55,380 --> 00:02:01,410 If there are any issues based upon the configurations like a certain user are, certain condition is 23 00:02:01,410 --> 00:02:07,890 not satisfying, then the matter and location will be stopped and the forbidden error will be sent back 24 00:02:07,890 --> 00:02:08,759 to the user. 25 00:02:08,910 --> 00:02:13,500 And at the same time, we also have another approach which is filtering authorization. 26 00:02:13,800 --> 00:02:21,300 Like I don't want to stop invocation of my method execution, but I want to control my business logic 27 00:02:21,300 --> 00:02:27,960 based upon the parameters that my maternal issue and the parameters that it sends back to the invocation 28 00:02:28,170 --> 00:02:30,630 method are AIPA are claimed. 29 00:02:30,780 --> 00:02:38,040 So in such scenarios, if I want to apply some filtering conditions like for certain parameters, my 30 00:02:38,040 --> 00:02:43,650 method execution should not happen or method business logic should not return. 31 00:02:43,650 --> 00:02:49,340 Any values that the user is expecting for all such scenarios will go for the filtering alteration. 32 00:02:49,530 --> 00:02:57,480 So to add to all this metal level security, spring security uses AOP module that we have inside the 33 00:02:57,480 --> 00:02:58,500 spring framework. 34 00:02:58,500 --> 00:03:06,510 So AOB module is something which it will provide some crosscourt or aspects which will access as intercept 35 00:03:06,510 --> 00:03:09,570 us whenever you define inside your application. 36 00:03:09,870 --> 00:03:16,290 So whenever we configure Matalan security inside our method, so spring security framework will leverage 37 00:03:16,290 --> 00:03:24,270 this AOB module and have interceptors to intercept our material location to decide whether the authorization 38 00:03:24,270 --> 00:03:26,470 rules configure is satisfied or not. 39 00:03:26,670 --> 00:03:33,240 And all this metal level configurations like operation rules can be configured by using the following 40 00:03:33,240 --> 00:03:33,870 Trevis. 41 00:03:34,050 --> 00:03:40,470 The most famous way is like by using the annotations address Beatriz's and post outrace. 42 00:03:40,470 --> 00:03:47,010 And at the same time, we also have another annotations from Java frameworks like Aderet Secular and 43 00:03:47,010 --> 00:03:49,050 Aderet rules alone. 44 00:03:49,260 --> 00:03:56,460 But compared to preauthorization, both Strattera is I could under direct rule allured are less powerful 45 00:03:56,460 --> 00:04:01,890 because they have certain limitations compared to pre address and post outrace. 46 00:04:02,130 --> 00:04:09,210 Due to that reason, a lot of people and a lot of applications, they are using pre operation post inside 47 00:04:09,210 --> 00:04:14,760 their code, but at the same time, we can't go ahead and use them directly inside our application, 48 00:04:14,760 --> 00:04:15,720 these annotations. 49 00:04:15,960 --> 00:04:23,430 So whenever you're using a global method, security annotation inside your configuration class, you 50 00:04:23,430 --> 00:04:28,770 have to enable them by passing these three parameters like proposal. 51 00:04:28,770 --> 00:04:32,580 And it is called true secular and it is equally true. 52 00:04:32,730 --> 00:04:34,400 And there are 250. 53 00:04:34,500 --> 00:04:41,060 Annable is equal to true if any of these three parameters is missing inside your enable global method 54 00:04:41,070 --> 00:04:48,470 security by default, that annotation you cannot use and springs' security framework will throw at it. 55 00:04:48,750 --> 00:04:54,480 So now we have a basic understanding on what this metal level security inside spring security framework. 56 00:04:54,660 --> 00:04:59,840 Let's try to understand in detail about invocation operation. 57 00:04:59,910 --> 00:05:05,250 Shall rules how we can apply our tradition rules during my vacation in the next world. 58 00:05:05,490 --> 00:05:06,010 Thank you. 59 00:05:06,030 --> 00:05:06,420 And by.