lib/rack/oauth2/server.rb in rack-oauth2-server-2.0.0.beta5 vs lib/rack/oauth2/server.rb in rack-oauth2-server-2.0.0.beta6

- old
+ new

@@ -74,11 +74,11 @@ # Creates and returns a new access grant. Actually, returns only the # authorization code which you can turn into an access token by # making a request to /oauth/access_token. # - # @param [String] identity User ID, account ID, etc + # @param [String,Integer] identity User ID, account ID, etc # @param [String] client_id Client identifier # @param [Array, nil] scope Array of string, nil if you want 'em all # @param [Integer, nil] expires How many seconds before access grant # expires (default to 5 minutes) # @return [String] Access grant authorization code @@ -97,11 +97,11 @@ # Returns AccessToken for the specified identity, client application and # scope. You can use this method to request existing access token, new # token generated if one does not already exists. # - # @param [String] identity Identity, e.g. user ID, account ID + # @param [String,Integer] identity Identity, e.g. user ID, account ID # @param [String] client_id Client application identifier # @param [Array, nil] scope Array of names, nil if you want 'em all # @return [String] Access token def token_for(identity, client_id, scope = nil) client = get_client(client_id) or fail "No such client" @@ -194,9 +194,10 @@ access_token = AccessToken.from_token(token) raise InvalidTokenError if access_token.nil? || access_token.revoked raise ExpiredTokenError if access_token.expires_at && access_token.expires_at <= Time.now.to_i request.env["oauth.access_token"] = token request.env["oauth.identity"] = access_token.identity + access_token.access! logger.info "RO2S: Authorized #{access_token.identity}" if logger rescue OAuthError=>error # 5.2. The WWW-Authenticate Response Header Field logger.info "RO2S: HTTP authorization failed #{error.code}" if logger return unauthorized(request, error)