Sha256: 47f7e9682aeab6263ac7908297bb4a3072a2b459ce62c73a35c44b0d6d640afe

Contents?: true

Size: 863 Bytes

Versions: 3

Compression:

Stored size: 863 Bytes

Contents

module OmniAuth
  module Strategies
    class CronofyServiceAccount < CronofyBase
      option :name, "cronofy_service_account"

      option :client_options, {
        :authorize_url => "/enterprise_connect/oauth/authorize",
      }

      def request_phase
        options[:authorize_params] = { delegated_scope: options[:delegated_scope]} if options[:delegated_scope]
        super
      end

      uid { raw_info['sub'] }

      info do
        {
          :domain => raw_info['cronofy.service_account.domain'],
        }
      end

      def callback_url
        options[:redirect_uri] || (full_host + script_name + callback_path)
      end

      extra do
        {
          'raw_info' => raw_info,
        }
      end

      def raw_info
        @raw_info ||= access_token.get("#{client_options[:api_url]}/v1/userinfo").parsed
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-cronofy-0.11.0 lib/omniauth/strategies/cronofy_service_account.rb
omniauth-cronofy-0.10.0 lib/omniauth/strategies/cronofy_service_account.rb
omniauth-cronofy-0.9.0 lib/omniauth/strategies/cronofy_service_account.rb