1
00:00:00,180 --> 00:00:08,100
Now we have a database already in the cloud and we know how to connect if we want to leverage JDBC user

2
00:00:08,100 --> 00:00:14,940
details manager, which is the implementation provided by spring security that extends user details

3
00:00:14,940 --> 00:00:15,600
manager.

4
00:00:15,840 --> 00:00:21,660
We have to add to the whatever expectations that this class has.

5
00:00:21,870 --> 00:00:30,120
The primary expectations that this class has is you should have the same table in the same column names

6
00:00:30,390 --> 00:00:38,190
inside your database also so that you are free to use this class without changing anything.

7
00:00:38,490 --> 00:00:45,390
But if you really have a requirement where you can go with this table and columns, names, we will

8
00:00:45,390 --> 00:00:48,780
see how to customize that in the coming radius.

9
00:00:49,050 --> 00:00:56,880
But in this scenario to test authentication mechanism using databases, user details manager, let's

10
00:00:56,880 --> 00:01:03,890
try to create the same tables with the same column names in the database that we just created.

11
00:01:04,170 --> 00:01:10,050
So the table names should be users, followed by the columns, names, username, password and enabled.

12
00:01:10,290 --> 00:01:16,890
And at the same time, we also have separate table for authorities, which is how a column, name,

13
00:01:17,070 --> 00:01:19,020
user name and authority.

14
00:01:19,380 --> 00:01:22,890
So now I'm going to the database here.

15
00:01:23,130 --> 00:01:25,890
First I have to create a database.

16
00:01:26,010 --> 00:01:28,100
So right now I have my score.

17
00:01:28,380 --> 00:01:36,570
But there is no database that I want to create my tables because inside an obscure server database we

18
00:01:36,570 --> 00:01:38,520
can have any number of databases.

19
00:01:38,850 --> 00:01:46,210
And since it's a brand new MySQL server, I just want to create a new database as per my requirement.

20
00:01:46,500 --> 00:01:53,130
I'm just naming the database as easy bank and executing this comment since we can.

21
00:01:53,460 --> 00:02:00,960
With the admin credential, we should have the right to create databases, tables, other users assign

22
00:02:00,960 --> 00:02:02,090
authorities to them.

23
00:02:02,340 --> 00:02:06,220
We can do anything on that database creation perspective.

24
00:02:06,360 --> 00:02:12,350
So now I have created and you can see on the left hand side a new database has been created.

25
00:02:12,480 --> 00:02:18,990
I'm just running use easy bang for my next Ezekial statements and I'm going to run.

26
00:02:19,320 --> 00:02:27,060
So now you can see that we have to execute this command to create temporary users with the same three

27
00:02:27,060 --> 00:02:32,450
columns that we have seen in the code, which is username, password and enabled.

28
00:02:32,820 --> 00:02:36,570
It is a column which maintains primary key value.

29
00:02:36,780 --> 00:02:40,080
And I'm running this statement by running.

30
00:02:40,380 --> 00:02:44,910
You should have a table name with users post that.

31
00:02:45,150 --> 00:02:52,500
I also want to create an authority table, as mentioned in the code, which have a user name link between

32
00:02:52,500 --> 00:02:59,850
these users and this authorities, followed by authority and the primary key value column, which is.

33
00:03:00,390 --> 00:03:09,300
So I'm also executing this command so it not to be selected and how to select use easy bank and around.

34
00:03:09,630 --> 00:03:13,980
This is good statement which will create authorities.

35
00:03:14,340 --> 00:03:22,550
Lastly, I am going to insert values inside this table, the very first table that we created as users.

36
00:03:22,830 --> 00:03:28,920
I'm going to create a user name called Happy With the Password one, three, four, five.

37
00:03:29,070 --> 00:03:35,040
And enable is an indication one one means it is enabled.

38
00:03:35,280 --> 00:03:36,900
Zero means it's a disabled.

39
00:03:36,900 --> 00:03:45,090
It's an indication to the framework post that I also how authorities were taking the same user which

40
00:03:45,090 --> 00:03:49,110
is happy and then giving authorities the right for him.

41
00:03:49,410 --> 00:03:55,270
So I'm running the both of them and now the data has been inserted.

42
00:03:55,320 --> 00:03:59,280
Now we have a proper user inside the database.

43
00:03:59,400 --> 00:04:07,740
The name Happy Now in the next video, let's try to connect this database into our application and leverages

44
00:04:08,040 --> 00:04:14,140
JBC user details manager to authenticate inside our application.

45
00:04:14,310 --> 00:04:14,960
Thank you.

46
00:04:14,970 --> 00:04:16,410
And see you next week by.

