# Design and Implementation of a Contextual-Based Continuous Authentication Framework for Smart Homes
## 4 Implementation
The user's security level, a combination of the device address, location, login, and time, determines whether a device can be accessed. New users are able to sign up on the site in order to gain access to restricted devices. By default, a new user is unverified and unable to log in until the homeowner confirms their account. The main user (the homeowner) could also then configure more specific permissions at device-level, permitting or denying access to particular devices based on the user's needs or the homeowner's trust of said user. Each user would also be able to have an associated calendar to determine when access to devices should be allowed. For this prototype, integration with a user's Google Calendar was used, along with a cached copy in the database. This allows both users to determine times when they will be away from home and therefore not accessing certain devices, as well as enables the homeowner to determine times to explicitly permit or deny access to certain devices by a user. New devices can be added to the system by connecting them to the wireless network intended for the device, and then going to the respective page. Devices are listed on the page based on the router's ARP table, acquired through SSH, and cross-referenced against the database to determine if they have already been added and configured. In addition to being able to set their name, description, and static IP, used devices can be set to only allow access from certain user accounts or be set to ignore location authentication if they are in a fixed location. IoT devices can also be configured to only permit access to certain users, along with many options, such as allowing external access, anonymous access, requiring location authentication, or restricting usage to certain devices or schedules. All actions by users are logged in the database against the device origin and the user credentials if logged in. This includes actions such as arriving or departing a location, accessing the site or devices, and logging in or out of the site. This logging allows for heuristic analysis and pattern matching, which could potentially be used in the future as another level of authentication. A user profile could be established based on their access patterns and a notification could be sent to the homeowner upon a given variance, or access could be pre-emptively denied. Finally, authentication is based on overall quality of the provided credentials. Users are granted access to different levels of services dependent on this overall quality. This quality is calculated by the homeowner during the setup, with assigned weights to each included authentication, for example: \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Brand** & **Device Type** & **Device Name** & **Network Interfaces** & **Revision** & **Power** \\ \hline Linksys & Wireless Router & \begin{tabular}{c} N300 Wi-Fi \\ Router \\ \end{tabular} & \begin{tabular}{c} 4x 10/100 Ethernet and \\ 802.11n Wi-Fi \\ \end{tabular} & E1200-V2 & AC to DC \\ \hline \begin{tabular}{c} Raspberry Pi \\ Foundation \\ \end{tabular} & \begin{tabular}{c} Single-Board \\ Computer \\ \end{tabular} & Raspberry Pi 3 & \begin{tabular}{c} 10/100 Ethernet, 802.11n \\ Wi-Fi and Bluetooth 4.1 \\ \end{tabular} & Model B & USB to DC \\ \hline \
\begin{tabular}{c} Belkin \\ \end{tabular} & Smart Switch &
\begin{tabular}{c} WeMo Insight \\ Switch \\ \end{tabular} & 802.11n Wi-Fi & F7C029V2 & AC \\ \hline Philips & Smart Bulb & Hue White A19 & ZigBee & 9290011369 & AC / Edison Socket \\ \hline Belkin & Camera & NetCam HD+ & 802.11b/g/n Wi-Fi & F7D7606v1 & DC \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Specifications of devices used in the implementation. location weight = 20%, calendar schedule data weight = 20%, time = 10%, username and password = 30%, and profile data (such as preferences) = 20%. Smart devices are setup with a required confidence level needed to access their services.