Adding basic implementation of authentication provider.
Some refactoring for more common serialization