1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

//! # Purpose
//! This crate includes traits and miscellaneous helpers
//! that help provide authentication to your rocket web app.
//! 
//! # Structure
//! The crate consists of an authorization module and a sanitization
//! helper module.  The authorization module provides two traits:
//! 
//! ## AuthorizeCookie
//! contains methods to store or retrieve a data structure from a cookie.
//! The `AuthorizeCookie` trait is implemented on a data structure that
//! contain all of data stored in the cookie, like username, display name,
//! email, etc.  Any data you wish to be readily available without an
//! expensive database lookup can be stored in the cookie data structure.
//! 
//! ## AuthorizeForm
//! contains methods to collect a data structure that contains the contents 
//! of a login form submission.  The credentials stored in the data structure 
//! are then authenticated and by using either the `flash_redirect()` or 
//! `redirect()` methods, the user can be redirected either to an admin 
//! dashboard for example or upon failure a retry login page.
//! 

/* Todo:
    Add a trait that will provide sanitization
        The trait will have default methods that call
        the basic sanitization methods in the sanitization module
        but can be overloaded when using in other crates to allow
        more customized security.

*/

#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(rocket_codegen)]

extern crate rocket;
extern crate unic_ucd;
// #[allow(unused_imports)] extern crate regex;
// #[allow(unused_imports)] #[macro_use] extern crate lazy_static;
// extern crate unic_ucd_category;

extern crate htmlescape;
pub mod authorization;
pub mod sanitization;