LOGGER  Logger
Data Logging using ESP8266
Functions | Variables
security.h File Reference
#include "basetype.h"

Go to the source code of this file.

Functions

void securityInit ()
 
bool securityReadAllowed ()
 
bool securityReadWriteAllowed ()
 
void securityConfigurationPage ()
 display the security configuration page
 

Variables

char readSignature [32]
 < version of this include file More...
 
char readWriteSignature [32]
 

Detailed Description

Support for the Security Paradigm.

Security is implemented by each web page checking if the use of that web page is permitted. The page startup code calls this module to ask if the page can be displayed. Pages that contain information to read and nothing that can store data call securityReadAllowed. Pages that can store data call securityReadWriteAllowed. Pages that require no security need not call this module at all.

When a request of a secure page is made the 'signature' argument should be supplied by the browser or program making the request. The value of that argument is matched against signatures stored in permanent memory. If a match to the appropriate stored value occurs this module confirms the match and the page allows itself to display. The signatures are stored as ASCIZ strings. No checking for valid strings is done by this module. Example request:

        http://192.168.1.1/samples.xml?signature='password'

The flash signatures can be cleared at system startup by this module. The module looks for files on the flash card called 'clearreadsignature.dat' and 'clearwritesignature.dat'. When the file is found the appropriate signature is cleared and the file is deleted. The content of the file does not matter.

Function Documentation

void securityInit ( )

Call once at system startup. This routine will determine if the signatures should be cleared. The flash file system must be initialize and ready to operate prior to calling this routine.

bool securityReadAllowed ( )

Test if reading is allowed. If reading is not allowed emit an error page and terminate the page with a call to webEndPage. (Assumes that the page was started with webStartPage).

NOTE: if the signature matches the write signature reads are allowed.

Returns
true if the web page signature argument matched the read signature, true if the web page signature argument matched the read/write signature, true if no read signature is stored, false otherwise
bool securityReadWriteAllowed ( )

Test if both reading and writing are allowed. If not allowed emit an error page and terminate the page with a call to webEndPage. (Assumes that the page was started with webStartPage).

NOTE: if the write signature is empty and the read signature is not the read signature must match to allow this page to display.

Returns
true if the web page signature argument matched the read/write signature, true if no read/write signature is stored, false otherwise

Variable Documentation

char readSignature[32]

< version of this include file

Stored signature for pages that require read access. This symbol is exposed to allow the parameters module to have access. It should not be used by others.

char readWriteSignature[32]

Stored signature for pages that require read/write access. This symbol is exposed to allow the parameters module to have access. It should not be used by others.