Sha256: e6a9af58d5b49d299dbe86775390bfd68c3c51a10efbc3d89330ee53faa348f5

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class AllScripts < OmniAuth::Strategies::OAuth2
      option :name, 'allscripts'

      option :client_options, {
        :site => 'https://pro171.open.allscripts.com',
        :authorize_url => 'https://pro171.open.allscripts.com/authorization/connect/authorize',
        :token_url => 'https://pro171.open.allscripts.com/authorization/connect/token'
      }

      option :scope, 'launch openid'

      uid do
        SecureRandom.hex(8) # Users endpoint for AllScripts does not exist or is not publically documented. Generate a random UID
      end

      info do
        access_token
      end

      def callback_url
        full_host + script_name + callback_path
      end

      alias :oauth2_access_token :access_token

      def access_token
        ::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
          :expires_in => oauth2_access_token.expires_in,
          :expires_at => oauth2_access_token.expires_at
        })
      end

    end
  end
end

OmniAuth.config.add_camelization 'allscripts', 'AllScripts'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-allscripts-1.0.0 lib/omniauth/strategies/allscripts.rb