README.rdoc in vidibus-oauth2_server-0.0.3 vs README.rdoc in vidibus-oauth2_server-0.0.4
- old
+ new
@@ -32,11 +32,11 @@
If you use the {Vidibus::Service}[https://github.com/vidibus/vidibus-service] gem, you'll get this method on the service model:
# Returns true if given client_secret matches signature.
def valid_oauth2_secret?(client_secret)
- client_secret == Vidibus::Secure.sign("#{Service.this.url}#{uuid}", secret)
+ client_secret == Vidibus::Secure.sign(uuid, secret)
end
=== User model
@@ -119,23 +119,12 @@
This gem will also provide an action to obtain data of the user currently logged in. The following route will be added:
get "/oauth/user" => "oauth2/users#show"
-You may overwrite the Oauth2::UsersController class to adjust it to your needs. However, if you want to use the default controller, you'll need a method on your ApplicationController to obtain a user by a given UUID.
+You may overwrite the Oauth2::UsersController class to adjust it to your needs. However, if you want to use the default controller, you'll need a User model that responds to <t>:uuid</t>.
-For a typical ActiveRecord model this would be:
-
- # Returns user matching given uuid
- def find_user_by_uuid(uuid)
- User.first(:conditions => {:uuid => uuid})
- end
-
-The default #show method of this controller delivers a JSON string including name, email and UUID of the current user:
-
- def show
- render :json => @user.attributes.only(*%w[name email uuid])
- end
+The default #show method of this controller delivers a JSON of attributes returned by User#oauth_attribute. If no such method exist, the response will include name, email and UUID of the current user.
== And the client side?
Well, this is just the server side of the story. To implement OAuth2 on your client applications, there are many solutions available. The basic tools are provided by the excellent {OAuth2}[https://github.com/intridea/oauth2] gem. For a sophisticated example, check out {OmniAuth}[https://github.com/intridea/omniauth].