Sha256: c516c70b49a863565a02df95dd3bb46eb0ffa1e2cd8ce24e40bf8fb010de307d
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'omniauth-oauth2' require 'multi_json' module OmniAuth module Strategies class MSUnet < OmniAuth::Strategies::OAuth2 option :client_options, { site: "https://oauth.ais.msu.edu", authorize_path: "/oauth/authorize", authorize_url: "/oauth/authorize", token_url: "/oauth/token" } uid do raw_info['uid'].to_s end info do { name: raw_info['info']['name'].to_s || raw_info['name'].to_s, first_name: raw_info['info']['first_name'].to_s || raw_info['first_name'].to_s, last_name: raw_info['info']['last_name'].to_s || raw_info['last_name'].to_s, email: raw_info['info']['email'].to_s || raw_info['email'].to_s, netid: raw_info['info']['email'].to_s || raw_info['email'].to_s } end extra do { :raw_info => raw_info } end def raw_info @raw_info ||= MultiJson.load(access_token.get("/oauth/me?access_token=#{access_token.token}").body) end end end end OmniAuth.config.add_camelization 'msunet', 'MSUnet'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-msunet-1.0.0 | lib/omniauth/strategies/msunet.rb |