Sha256: 28c85017f840713b55d3643db99c9f5e40b292e09253b6dc362c354277e93478

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

require "omniauth-oauth2"
require "applicaster/accounts"

module OmniAuth
  module Strategies
    class Applicaster < OmniAuth::Strategies::OAuth2
      option :name, :applicaster

      uid { raw_info["id"] }

      info do
        {
          name: raw_info["name"],
          email: raw_info["email"],
          admin: raw_info["admin"],
          account_id: raw_info["account_id"],
          global_roles: raw_info["global_roles"],
          permissions: raw_info["permissions"],
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/v1/users/current.json').parsed
      end

      def client
        ::Applicaster::Accounts.oauth_client
      end

      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
omniauth-applicaster-2.0.0 lib/omniauth/strategies/applicaster.rb
omniauth-applicaster-1.9.0 lib/omniauth/strategies/applicaster.rb
omniauth-applicaster-1.8.0 lib/omniauth/strategies/applicaster.rb
omniauth-applicaster-1.7.1 lib/omniauth/strategies/applicaster.rb