Sha256: 647e89e46ed4a2b724c3578765b82ae4a6a4490e92827ec0c25ecd24bda52a5b

Contents?: true

Size: 769 Bytes

Versions: 1

Compression:

Stored size: 769 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
	module Strategies
		class Eivo < OmniAuth::Strategies::OAuth2
		
			option :name, "eivo"

			option :client_options, { :site => "https://sso.eivo.fr" }

			uid { raw_info['id'] }

			info do
				{
					:email => raw_info['email'],
					:name => "#{raw_info['firstname']} #{raw_info['lastname']}",
					:first_name => raw_info['firstname'],
					:last_name => raw_info['lastname']
				}
			end

			extra do
				{
					'raw_info' => raw_info
				}
			end

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

			# Required for omniauth-oauth2 >= 1.4
			# https://github.com/intridea/omniauth-oauth2/issues/81
			def callback_url
				full_host + script_name + callback_path
			end

		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-eivo-oauth2-1.0.2 lib/omniauth/strategies/eivo.rb