README.md in authorizme-0.0.2 vs README.md in authorizme-0.0.3

- old
+ new

@@ -28,18 +28,45 @@ ## Usage ### Getting started +#### Authorization + To authorize user with basic authorization, post email and password to `/authorizme/sessions`. (if you have another namespace, use `/{your_namespace}/sessions`) To authorize user with providers, use `/authorizme/login/{provider_name}`. Before that you MUST set your api keys and secrets to those providers in `config/initializers` To register user with basic authorization you can just save data to your user model and then call `login(user)` from your controller. +#### Using roles + +Also you can set roles. Just add some roles in Role model and then set it to user. In controller you can use `before_filter` method `require_user` or `require_{role}` where `role` is your required role name. + ### Advanced usage -You can implement your own provider. Create controller under model `Authorizme::Login` and extend `AuthorizmeController`. Then you must implement `auth` and `callback` methods, where `auth` is method which redirect user to provider and `callback` get data from provider callback data. Then you must add your provider namespace in authorizme config file in array `providers`. +#### Custom provider callback view + +By default providers use callback view which require JQuery and require `eventBus` in `window` dom element: + +```javascript +<script type="text/javascript"> + $(document).ready(function() { + window.close(); + window.opener.eventBus.trigger("loginDone"); + window.opener.focus(); + }); +</script> +``` +You can override this by creating new view: `views/authorizme/authorizme/popup.html.erb`. + +#### Custom providers + +You can implement your own provider: + +1. Create controller under model `Authorizme::Login` and extend `AuthorizmeController`. +2. You must implement `auth` and `callback` methods, where `auth` is method which redirect user to provider and `callback` get data from provider callback data. +3. Then you must add your provider namespace in authorizme config file in array `providers`. ## Development Questions or problems? Please post them on the [issue tracker](https://github.com/CreativeMobile/authorizme/issues). You can contribute changes by forking the project and submitting a pull request. You can ensure the tests passing by running `bundle` and `rake`. \ No newline at end of file