refactored security. broke security modules out into separate files.

- added utils for shared functions