1 00:00:00,150 --> 00:00:07,770 In the previous videos, we have created users and the passwords, authorities using user details, 2 00:00:07,770 --> 00:00:13,210 user details, service, user, details, manager, and this is the code that we have created. 3 00:00:13,230 --> 00:00:19,160 But do we know what is the relationship between all of them that spring security follows? 4 00:00:19,210 --> 00:00:21,010 No, we have not looked into that. 5 00:00:21,030 --> 00:00:28,620 Let's try to go and look into deep how this all user detailed user details of these user details. 6 00:00:28,620 --> 00:00:31,850 Manager all are interlinked with each other. 7 00:00:33,290 --> 00:00:40,730 This is a slide that can help you in understanding how end user will be managed by spring security, 8 00:00:40,790 --> 00:00:49,730 we how all important interfaces and classes revolving around user management insights bring security. 9 00:00:49,760 --> 00:00:56,420 We know whether we're dealing with authentication and authorization in any framework we need. 10 00:00:56,600 --> 00:01:02,280 User details are customer details or want to access our application. 11 00:01:02,330 --> 00:01:07,120 That's way we call it as user management in spring security. 12 00:01:07,160 --> 00:01:13,100 If we see the very bottom interface that we have is user details. 13 00:01:13,100 --> 00:01:21,380 User details is an interface which will define the schema or blueprint of the user that we are going 14 00:01:21,380 --> 00:01:23,850 to deep inside an application. 15 00:01:23,870 --> 00:01:33,260 It will how various methods like get password, get user name, get authorities like all these are needed 16 00:01:33,380 --> 00:01:39,530 for my spring security framework to decide whether the given user is a valid user. 17 00:01:39,920 --> 00:01:42,220 Again, these are all abstract methods. 18 00:01:42,380 --> 00:01:49,700 Whatever user that we are going to create schema which is specific to our framework, we have to make 19 00:01:49,700 --> 00:01:58,160 sure implementing these user detailed interface and this interface has all the methods revolving around 20 00:01:58,160 --> 00:01:59,140 security. 21 00:01:59,300 --> 00:02:03,500 Like I want the user name, I want the password authorities. 22 00:02:03,500 --> 00:02:06,580 I want to know whether the account is expired or not. 23 00:02:06,800 --> 00:02:10,100 Our current expert is the account is enabled or not. 24 00:02:10,130 --> 00:02:18,860 All such possible user related information is backed into an interface called user detailed inside our 25 00:02:18,860 --> 00:02:19,880 spring security. 26 00:02:19,880 --> 00:02:21,800 So user details is an interface. 27 00:02:22,070 --> 00:02:27,800 And these are all the abstract methods available inside this interface. 28 00:02:27,830 --> 00:02:34,520 Whenever we are trying to create our own user schema definition specific to our application, we have 29 00:02:34,520 --> 00:02:42,140 to make sure implementing this interface pos that we how user details service. 30 00:02:42,170 --> 00:02:50,130 So this is an interface again, which have a single abstract method called law user by user name. 31 00:02:50,300 --> 00:02:58,210 Ideally, most of the applications they just wanted to validate whether the given user is present inside 32 00:02:58,220 --> 00:03:05,330 a database or an application inside and memory of my spring security container. 33 00:03:05,690 --> 00:03:12,890 So in altered scenarios, we just pass user name to this abstract method that we are receiving from 34 00:03:12,890 --> 00:03:22,160 the UI and this method we have in logic of patching the user details from the database or relapser out 35 00:03:22,190 --> 00:03:24,410 from the memory of the spring container. 36 00:03:24,530 --> 00:03:32,840 So user detailed is an interface which have a logic of attaching the user from the database or any other 37 00:03:32,840 --> 00:03:33,440 place. 38 00:03:33,530 --> 00:03:41,540 And the return type of law, user by user name is user details, because whenever we are dealing with 39 00:03:41,570 --> 00:03:48,550 users, we decided to use user detailed schema adhering to that spring security. 40 00:03:48,710 --> 00:03:57,020 Once we use a digital service, we also have user details manager, which again extends this interface. 41 00:03:57,290 --> 00:04:05,690 So User Details Manager is an interface which again extends user details service, followed by where 42 00:04:05,690 --> 00:04:12,390 this user details service will use this user details and schema to maintain the user data. 43 00:04:12,500 --> 00:04:20,480 The primary difference between user details, service and user details manager interface is user detail. 44 00:04:20,490 --> 00:04:27,620 Service will be using only in the scenario where I have a requirement to only fetch the user details 45 00:04:27,620 --> 00:04:30,380 from the database or any other place. 46 00:04:30,530 --> 00:04:31,700 In such scenarios. 47 00:04:31,850 --> 00:04:39,390 We will go and use user detail service by implementing it and customizing espera requirements. 48 00:04:39,470 --> 00:04:48,290 But if your application how a requirement to also maintain the user details that I want to create user. 49 00:04:48,320 --> 00:04:55,250 I want to update, delete, change passwords along with fetching the user details inserts in adieus. 50 00:04:55,460 --> 00:05:01,880 We have to make sure we are customizing by implementing user details. 51 00:05:01,880 --> 00:05:02,340 Maneesha. 52 00:05:02,510 --> 00:05:09,410 So since user details manager has extending this user detailed service also, that means along with 53 00:05:09,410 --> 00:05:16,580 this method, it also inherits load user by user name, user details manager handles everything like 54 00:05:16,580 --> 00:05:22,960 maintaining the user, switching the user name where user details service will only have better call 55 00:05:22,970 --> 00:05:27,050 load user by user name, which will fetch the data at the same time. 56 00:05:27,050 --> 00:05:28,740 Spring security provider. 57 00:05:28,750 --> 00:05:32,660 Defamers user details manager implementation. 58 00:05:32,930 --> 00:05:39,800 So whatever you're seeing in the top, all these are classes and they are default implemented by spring 59 00:05:39,800 --> 00:05:48,830 security framework itself, by leveraging or by extending implementing this user details, manager interface, 60 00:05:48,830 --> 00:05:50,750 in-memory user details manager. 61 00:05:50,750 --> 00:05:58,160 We already seen in the last videos where it maintains the users it will create the user, fetch the 62 00:05:58,160 --> 00:06:00,860 users from the memory of the spring container. 63 00:06:01,160 --> 00:06:04,580 That's why we call it as in memory user details manager. 64 00:06:04,820 --> 00:06:11,240 At the same time, ideal way of maintaining the users will be in the database in such scenarios, whether 65 00:06:11,240 --> 00:06:17,780 you are masculine, Oracle or Mangat, to be wherever you are saving your user details, we will go 66 00:06:17,780 --> 00:06:23,450 and use already implemented class, which is due to this user details manager. 67 00:06:23,900 --> 00:06:28,850 And at the same time, if you have a requirement where the users are maintained an alert observer, 68 00:06:29,120 --> 00:06:35,570 we will go ahead and use the user data manager class in our application. 69 00:06:35,600 --> 00:06:39,230 But again, these are all provided by spring security. 70 00:06:39,380 --> 00:06:43,570 We are free to use them as power requirements at any scenario. 71 00:06:43,700 --> 00:06:51,170 If these three passes are not matching with our requirements, we are free to go and implement this 72 00:06:51,170 --> 00:06:57,260 user details manager and override all these methods aspart requirements. 73 00:06:57,550 --> 00:06:59,810 Now we have seen enough of Peery. 74 00:07:00,020 --> 00:07:08,780 Let's try to go and see each component by component, which is revolving around user management inside 75 00:07:08,780 --> 00:07:12,860 the framework and try to do some Hands-On application. 76 00:07:12,860 --> 00:07:21,320 Also, hope this is making sense to you and I can assure you these things will make more sense in the 77 00:07:21,320 --> 00:07:22,390 coming videos. 78 00:07:22,400 --> 00:07:23,050 Thank you. 79 00:07:23,060 --> 00:07:23,570 And by.