WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.400 --> 00:00:10.300
Welcome back guys to video number 7.4 where

1
00:00:10.300 --> 00:00:14.200
 we're going to talk about authentication and authorization actually

2
00:00:13.200 --> 00:00:16.800
 without authentication and authorization

3
00:00:16.800 --> 00:00:19.600
 iot devices are full of vulnerability.

4
00:00:20.400 --> 00:00:24.100
In anybody can access your device without authentication

5
00:00:23.100 --> 00:00:26.500
 and it can do whatever they want.

6
00:00:26.500 --> 00:00:29.400
 So emqx provide a very

7
00:00:29.400 --> 00:00:33.400
 beautiful interface for Access and authentication. So

8
00:00:32.400 --> 00:00:33.600
 just

9
00:00:35.900 --> 00:00:38.300
login to your emqx panel by

10
00:00:38.300 --> 00:00:42.700
 tapping localhost or column 18083

11
00:00:41.700 --> 00:00:44.500
 port and here we

12
00:00:44.500 --> 00:00:47.600
 will click on the excess control and on the Authentication.

13
00:00:48.400 --> 00:00:50.100
And just click on the create.

14
00:00:51.300 --> 00:00:54.900
and here we will have a three options password base JWT

15
00:00:54.900 --> 00:00:55.200
 and

16
00:00:56.400 --> 00:00:59.600
scram and it is a different authentication technique, but

17
00:00:59.600 --> 00:01:02.400
 we are going to use the password paste authentication technique.

18
00:01:02.400 --> 00:01:03.500
 So click on the next.

19
00:01:04.600 --> 00:01:07.600
And here we have a lot of different options built-in database

20
00:01:07.600 --> 00:01:11.300
 MySQL mongodb post ask postery

21
00:01:10.300 --> 00:01:13.600
 SQL and redis reduces a

22
00:01:13.600 --> 00:01:16.700
 very old Triple A authentication server.

23
00:01:16.700 --> 00:01:19.500
 So you guys can use that rediff if

24
00:01:19.500 --> 00:01:22.800
 your organization is already using that to avoid

25
00:01:22.800 --> 00:01:25.100
 the duplication of

26
00:01:25.100 --> 00:01:28.000
 data entry regarding the users. But right now I'm going

27
00:01:28.200 --> 00:01:31.300
 to use the built-in database but MySQL is also good option and the

28
00:01:31.300 --> 00:01:34.600
 mongodb is a no escalator base and majority of

29
00:01:34.600 --> 00:01:37.600
 developers are now using mongodb to store the

30
00:01:37.600 --> 00:01:38.700
 data and

31
00:01:40.400 --> 00:01:44.300
it's the requirement of current scenario that people are

32
00:01:44.300 --> 00:01:48.100
 using modern stack mean stack and mongodb

33
00:01:47.100 --> 00:01:50.500
 is a by default in that stack. So right

34
00:01:50.500 --> 00:01:53.400
 now we're going to use the HTM built-in database and click on

35
00:01:53.400 --> 00:01:53.700
 that.

36
00:01:54.900 --> 00:01:57.500
And select the username. Yes. We are

37
00:01:57.500 --> 00:02:01.000
 not using the client ID. We will use the username here. We

38
00:02:00.500 --> 00:02:05.500
 have option how to store the password sha2506 md5

39
00:02:04.500 --> 00:02:07.300
 airplane as such a

40
00:02:07.300 --> 00:02:10.200
 256 is a good to go and suffix is good

41
00:02:10.200 --> 00:02:11.400
 create and now

42
00:02:12.800 --> 00:02:15.100
it works come to authorization.

43
00:02:16.300 --> 00:02:19.900
And here need to create on built-in database next and

44
00:02:19.900 --> 00:02:21.500
 create and we're good to go with that.

45
00:02:22.200 --> 00:02:24.000
Again, go back to the Authentication.

46
00:02:24.800 --> 00:02:27.100
And click on the users and now we

47
00:02:27.100 --> 00:02:30.800
 need to add the users. So click on ADD and

48
00:02:30.800 --> 00:02:31.600
 type here.

49
00:02:32.200 --> 00:02:33.900
Dev one

50
00:02:34.600 --> 00:02:37.200
and one two, three is a password.

51
00:02:37.200 --> 00:02:40.400
 Okay, and you can add as

52
00:02:40.400 --> 00:02:41.000
 many users.

53
00:02:41.800 --> 00:02:43.900
to have two main device to

54
00:02:45.200 --> 00:02:45.600
okay.

55
00:02:46.900 --> 00:02:49.600
So this is the authentication but

56
00:02:49.600 --> 00:02:52.300
 what is meant by authorization? For example,

57
00:02:52.300 --> 00:02:55.600
 we have a two devices and we have a separate

58
00:02:55.600 --> 00:02:58.800
 separate topics, but we only want that this

59
00:02:58.800 --> 00:03:01.600
 device only send data to the specific topic

60
00:03:01.600 --> 00:03:04.400
 and this user name and password

61
00:03:04.400 --> 00:03:08.100
 send the data to specific topic. So

62
00:03:07.100 --> 00:03:10.800
 this will solve in authorization

63
00:03:10.800 --> 00:03:13.800
 where we will put all the settings. So

64
00:03:13.800 --> 00:03:17.100
 firstly we need to verify the authentication. Okay, so

65
00:03:16.100 --> 00:03:19.500
 firstly I need to type here localhost.

66
00:03:21.200 --> 00:03:22.600
localhost and

67
00:03:23.500 --> 00:03:26.100
883 and here I'm going

68
00:03:26.100 --> 00:03:29.400
 to use the topic Home Room 1 and

69
00:03:29.400 --> 00:03:32.300
 this is the temperature. Okay and connect and you

70
00:03:32.300 --> 00:03:36.200
 will get the error because now the authentication is enabled but

71
00:03:35.200 --> 00:03:38.100
 if you want to disable your authentication, you can

72
00:03:38.100 --> 00:03:41.900
 just click on that and your authentication will be disabled and

73
00:03:41.900 --> 00:03:44.100
 now we are good to go and you see we are connected

74
00:03:44.100 --> 00:03:45.300
 disconnected again.

75
00:03:46.200 --> 00:03:48.000
And we're going to enable it again.

76
00:03:49.700 --> 00:03:52.400
And now try and it will say the issue. So

77
00:03:52.400 --> 00:03:55.600
 click on authentication and provide the password

78
00:03:55.600 --> 00:03:58.200
 Dev username and tab 1 2

79
00:03:58.200 --> 00:04:01.400
 3 is a password connect it and we're good to go with that. Okay.

80
00:04:01.400 --> 00:04:03.900
 Now it works fine and

81
00:04:06.500 --> 00:04:08.300
Yeah, I need to open the terminal.

82
00:04:09.700 --> 00:04:11.500
mosquito underscores

83
00:04:12.900 --> 00:04:15.800
minus age localhost minus

84
00:04:15.800 --> 00:04:16.500
 p

85
00:04:17.600 --> 00:04:20.600
1803 minus t topic to

86
00:04:20.600 --> 00:04:23.000
 save the time. I need to copy that topic.

87
00:04:23.500 --> 00:04:23.900
and

88
00:04:25.500 --> 00:04:26.900
topic minus

89
00:04:28.200 --> 00:04:30.100
Okay type it and it will give you.

90
00:04:31.700 --> 00:04:34.600
Authorization error. So I need

91
00:04:34.600 --> 00:04:38.300
 to here type A minus U Dev 1 minus

92
00:04:37.300 --> 00:04:40.800
 capital P and

93
00:04:40.800 --> 00:04:43.100
 1 2 3. It's a password and now we are

94
00:04:43.100 --> 00:04:44.900
 going to go with that. Okay.

95
00:04:45.700 --> 00:04:48.700
This is the difference small piece for port and

96
00:04:48.700 --> 00:04:51.500
 the capital P is for the password. Okay.

97
00:04:51.500 --> 00:04:53.700
 I'm going to type here 18.

98
00:05:08.400 --> 00:05:08.900
Okay.

99
00:05:11.800 --> 00:05:14.700
minus t topic

100
00:05:24.800 --> 00:05:27.300
Oh, yes now it's maybe there's

101
00:05:27.300 --> 00:05:30.100
 a glitch that it's not showing but now

102
00:05:30.100 --> 00:05:33.500
 you see here that I think there is an

103
00:05:33.500 --> 00:05:36.700
 issue with that because the mosquito underscore

104
00:05:36.700 --> 00:05:40.300
 sub is divided by the eclipse Foundation, but it

105
00:05:40.300 --> 00:05:42.700
 has a client. I think it didn't.

106
00:05:44.500 --> 00:05:47.400
Need to do just like that stuff because it's got us

107
00:05:47.400 --> 00:05:51.200
 stuck. Okay, so now it's good to go with that. And now

108
00:05:50.200 --> 00:05:53.400
 what I need to do is I need

109
00:05:53.400 --> 00:05:53.700
 to

110
00:05:55.900 --> 00:05:59.400
try out for example Room 2 and

111
00:05:58.400 --> 00:06:00.300
 I need to

112
00:06:01.500 --> 00:06:04.000
Open up another terminal CMD.

113
00:06:05.900 --> 00:06:06.200
Sorry.

114
00:06:17.600 --> 00:06:19.300
I just copy that command.

115
00:06:22.100 --> 00:06:23.000
to save the time

116
00:06:31.600 --> 00:06:34.300
control V and here I'm going to change it to

117
00:06:34.300 --> 00:06:36.100
 the room, too.

118
00:06:38.400 --> 00:06:41.200
And in the room to what I will do is

119
00:06:41.200 --> 00:06:44.400
 again connect and here I'm going to drive the

120
00:06:44.400 --> 00:06:46.200
 hundred. Okay sand.

121
00:06:47.700 --> 00:06:50.600
And it's sending now the issue is that that this

122
00:06:50.600 --> 00:06:51.000
 username?

123
00:06:51.900 --> 00:06:52.400
should

124
00:06:53.400 --> 00:06:56.300
send and receive regarding Room 1 not to

125
00:06:56.300 --> 00:07:00.000
 Room 2. So how we can limit to that

126
00:06:59.700 --> 00:07:02.100
 user. So click on the authorization.

127
00:07:03.700 --> 00:07:06.700
And in the built-in database permissions here.

128
00:07:06.700 --> 00:07:09.400
 We will click on that topic client ID

129
00:07:09.400 --> 00:07:11.700
 doesn't need and

130
00:07:14.100 --> 00:07:16.200
publish purpose

131
00:07:21.500 --> 00:07:24.500
I think for the all users is for

132
00:07:24.500 --> 00:07:24.900
 the users.

133
00:07:25.800 --> 00:07:28.400
Yes, no, no to the

134
00:07:28.400 --> 00:07:30.300
 specific. I need to type username. Okay?

135
00:07:30.900 --> 00:07:33.100
For the specific user. We have a

136
00:07:33.100 --> 00:07:34.900
 Dev 1 and

137
00:07:35.700 --> 00:07:36.600
only allow

138
00:07:38.600 --> 00:07:41.600
to the specific topic. What is the specific topic

139
00:07:41.600 --> 00:07:42.200
 is?

140
00:07:43.300 --> 00:07:45.400
Room 1 don't worry, I'm going to

141
00:07:46.300 --> 00:07:48.400
okay, I will type here room.

142
00:07:49.100 --> 00:07:52.700
One and temperature. Okay, Bob and

143
00:07:52.700 --> 00:07:55.400
 sub both are allowed operations on that.

144
00:07:55.400 --> 00:07:57.500
 Okay, and for

145
00:07:58.800 --> 00:07:59.700
dev2

146
00:08:02.400 --> 00:08:03.100
will allow

147
00:08:04.900 --> 00:08:07.300
or you can say slash home slash

148
00:08:07.300 --> 00:08:09.700
 room to temperature.

149
00:08:13.400 --> 00:08:16.200
Okay, and we are good to go with that. Now we will try it

150
00:08:16.200 --> 00:08:19.700
 again and try to send and it's sending again

151
00:08:19.700 --> 00:08:22.100
 and again, but still we need to

152
00:08:38.400 --> 00:08:40.400
Yes, maybe we can restrict.

153
00:09:19.900 --> 00:09:22.400
So guys. I hope you like the authentication how

154
00:09:22.400 --> 00:09:25.200
 we can configure the username and password and how the system

155
00:09:25.200 --> 00:09:28.300
 works. So I see you in the next video. We're going to send the

156
00:09:28.300 --> 00:09:31.500
 data to the cloud. So you guys in the next we have a good day. Bye.
