Sha256: 12c4d116f5a460274a8ba335aac826f0af950481ee3044d1d1882aa4e140eb21
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
module Devise module Oauth2 module Authorization extend ActiveSupport::Concern def current_oauth2_client(opts: { secure: false }) return @secure_client ||= Client.find_by(secret: client_secret) if opts[:secure] return @secure_client ||= Client.find_by(id: current_access_token.client_id) if access_token? @client ||= Client.find_by('identifier = :client_id OR secret = :secret', client_id: client_id, secret: client_secret) if client_credentials? end def current_access_token @access_token ||= AccessToken.find_by(token: access_token) end def oauth2_client_signed_in? !!@client end def access_token_signed_in? !!@access_token end def client_credentials client_id? || client_secret? end def client_credentials? !!client_credentials end def client_secret params[:client_secret] end def client_secret? !!client_secret end def client_id params[:client_id] end def client_id? !!params[:client_id] end def access_token params[:access_token] end def access_token? !!access_token end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise_oauth2_rails4-2.1.0 | app/controllers/devise/oauth2/authorization.rb |
devise_oauth2_rails4-2.0.2 | app/controllers/devise/oauth2/authorization.rb |