basic implementation of an authorization system (works on client and server)
fixing some bugs and some refactoring