Sha256: b599f2a3ad28406126fa9f4e50252c11e1bb117f002b406a4af09eb455f1408b

Contents?: true

Size: 943 Bytes

Versions: 11

Compression:

Stored size: 943 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Sso < OmniAuth::Strategies::OAuth2

      def raw_info
        @raw_info ||= access_token.get("#{_provider[:user_url]}.json?oauth_token=#{access_token.token}").parsed
      end

      def self._provider; SsoClyent.provyder;end
      def _provider; SsoClyent.provyder;end

      option :client_options, {
        :site =>  _provider[:url],
        :authorize_url => _provider[:authorize_url],
        :token_url => _provider[:access_token_url]
      }
      option :provider_ignores_state, true

      uid { raw_info[_provider[:user][:uid]] }

      info do
        _provider[:user][:info].inject({}) do |h,inf|
          h.merge({inf.to_sym => raw_info.send(:[], inf)})
        end
      end

      extra do
        _provider[:user][:extras].inject({}) do |h,inf|
          h.merge({inf.to_sym => raw_info['extra'].try(:[], inf)})
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sso_clyent-0.0.7.4 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.7.3 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.7.2 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.7.1 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.7 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.6 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.5 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.4 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.3 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.2 lib/sso_clyent/omniauth/strategies/sso.rb
sso_clyent-0.0.1 lib/sso_clyent/omniauth/strategies/sso.rb