1 00:00:00,180 --> 00:00:08,039 In this video, let's try to see in detail about the very first component of user management, which 2 00:00:08,039 --> 00:00:11,670 is user details that we are seeing in the bottom of this section. 3 00:00:12,830 --> 00:00:19,580 I came to the court that we have customers previously and I'm trying to open the user details, which 4 00:00:19,580 --> 00:00:27,880 is present inside the Security Framework Library with the package security dot dot user details. 5 00:00:27,920 --> 00:00:36,710 So if we see here, this is a simple interface which has some abstract methods like what are the authorities 6 00:00:36,710 --> 00:00:40,400 associated by the user password user name? 7 00:00:40,580 --> 00:00:47,780 And at the same time, we also have all possible options that we can have in our application. 8 00:00:47,990 --> 00:00:56,120 Suppose I want to check whether my account is whether my user account is along with the credentials 9 00:00:56,120 --> 00:00:57,100 are experiencing. 10 00:00:57,110 --> 00:01:03,140 That is where we have to force the user to change his credentials every 60 days or 90 days for such 11 00:01:03,140 --> 00:01:03,660 scenarios. 12 00:01:03,680 --> 00:01:09,560 We have these credentials among expert and at the same time there might be scenarios where you want 13 00:01:09,560 --> 00:01:15,500 to lock you up or disable your user for multiple authentication filters. 14 00:01:15,680 --> 00:01:22,810 So for some scenarios we have reasonable and at the same time we can also leverage is action online. 15 00:01:23,140 --> 00:01:25,890 So again, this is just an interface. 16 00:01:26,180 --> 00:01:34,670 Suppose I don't have a very big application where there is no need for me to create my own user schema. 17 00:01:34,670 --> 00:01:36,020 In such scenarios. 18 00:01:36,140 --> 00:01:44,630 We can go with the sample implementation provided by the Spring Security Council, which is user. 19 00:01:44,840 --> 00:01:51,910 So if you see here, they also put in the commands, see the user for a reference implementation. 20 00:01:52,130 --> 00:02:00,200 That means in a scenario where I don't have a major requirement and I'm good with whatever spring security 21 00:02:00,200 --> 00:02:08,650 schema is providing like user name password authorities, then we can leverage user class privacy here. 22 00:02:08,930 --> 00:02:12,790 User class implements our user details. 23 00:02:12,950 --> 00:02:22,070 It has variables of password user name authorities and the booleans, which indicates whether my account 24 00:02:22,070 --> 00:02:23,980 is active or not. 25 00:02:24,080 --> 00:02:30,170 We have to make sure these variables names should not be changed because these are the things that I 26 00:02:30,170 --> 00:02:32,650 understand by our spring security. 27 00:02:32,900 --> 00:02:39,710 That's why whenever we create our own custom class implementing user details, make sure you're adhering 28 00:02:39,710 --> 00:02:43,110 to the same naming conventions and name variables. 29 00:02:43,130 --> 00:02:50,570 So once we have these declarations, we have a constructor where someone wants to create a new user, 30 00:02:50,720 --> 00:02:52,940 bypassing the user name password. 31 00:02:52,940 --> 00:02:59,860 And authorities post that we have another constructor inside the same user class. 32 00:02:59,870 --> 00:03:08,180 The difference between this constructor and the upper constructor is we pass on the boolean details 33 00:03:08,180 --> 00:03:15,110 also in this constructor, whereas in the upper constructor we just pass mandatory details like username, 34 00:03:15,230 --> 00:03:17,120 password and authorities. 35 00:03:17,120 --> 00:03:23,810 And by default, spring security will set all other boolean values to prove that means. 36 00:03:23,930 --> 00:03:26,720 Is my account nonexperts true means? 37 00:03:26,720 --> 00:03:28,500 That is not the same. 38 00:03:28,520 --> 00:03:30,680 It is my account nonlawyer. 39 00:03:30,890 --> 00:03:35,300 That means when its value is true, which indicates account is not. 40 00:03:35,650 --> 00:03:36,990 It's a positive scenario. 41 00:03:37,190 --> 00:03:45,410 That's why by default it is setting to do so that our user will be processed with the correct username 42 00:03:45,410 --> 00:03:46,790 and password is provided. 43 00:03:46,820 --> 00:03:54,460 But if we have a scenario where you have your own logic of determining whether a country's non expert 44 00:03:54,500 --> 00:04:00,860 or non log from the value stored from your database, you are free to parse those details. 45 00:04:00,860 --> 00:04:06,130 Also, accordingly, the user object will be built using this constructor. 46 00:04:06,140 --> 00:04:13,430 So whenever we are using these constructors and trying to create an user object of user details, interface 47 00:04:13,430 --> 00:04:20,959 implementation, we have a getter methods which are essentially abstract methods inside this user details 48 00:04:20,959 --> 00:04:21,860 interface. 49 00:04:21,860 --> 00:04:30,020 And all those abstract methods have been implemented here by retaining the values that we received when 50 00:04:30,020 --> 00:04:33,020 we are creating a user object using its constructor. 51 00:04:33,020 --> 00:04:40,610 And at the same time this user class, which is by default implemented by our spring security, people 52 00:04:40,760 --> 00:04:44,210 having builder class, also user builder class. 53 00:04:44,240 --> 00:04:47,770 So we have a user builder in our class. 54 00:04:47,840 --> 00:04:55,850 Inside this user, the purpose of this is if we want to create users, we will leverage this user builder 55 00:04:55,850 --> 00:04:59,600 class like we have discussed in the previous videos. 56 00:04:59,600 --> 00:05:06,770 If we go and see here that we have implemented first, my application is very simple application and 57 00:05:06,920 --> 00:05:11,750 I don't want to define my own implementation of user detail, that's why. 58 00:05:12,200 --> 00:05:19,100 I'm going ahead and using the default implementation provided by the spring security, which is user 59 00:05:19,250 --> 00:05:27,240 and with user, I'm trying to create with the username password authorities by using the bill. 60 00:05:27,440 --> 00:05:35,060 So this is one of the the other way is by directly calling the constructor with the values, bypassing 61 00:05:35,090 --> 00:05:36,750 the constructor arguments. 62 00:05:37,070 --> 00:05:41,180 So there are two ways, but here we have implemented one. 63 00:05:41,630 --> 00:05:48,500 So right now we understand completely about user details, interface and the default implementation 64 00:05:48,500 --> 00:05:50,010 of it, which is user. 65 00:05:50,030 --> 00:05:51,140 So it's very simple. 66 00:05:51,290 --> 00:05:58,550 If we are good with the default schema provided by the user details interface inside spring security, 67 00:05:58,730 --> 00:06:02,880 you are free to use the user class implementation. 68 00:06:03,100 --> 00:06:10,940 Otherwise, if you want to have your own blueprint or schema for your application, then the customization 69 00:06:10,940 --> 00:06:15,680 has to be done by implementing this user detailed interface. 70 00:06:15,710 --> 00:06:24,230 So with this, assuming it is hoping to you about the user details interface, which carries the blueprint 71 00:06:24,380 --> 00:06:28,470 and schema of our user inside any application. 72 00:06:28,880 --> 00:06:29,450 Thank you. 73 00:06:29,580 --> 00:06:37,790 In next video, we will see about user details, service interface, which is the very next important 74 00:06:37,790 --> 00:06:39,710 component of user data. 75 00:06:40,010 --> 00:06:40,940 Thank you by.