Sha256: e7b2818ccd91c5a62384b8f9d4612461d9c7ea9c44bbbe832b60eebc4bda05e8
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require "omniauth-oauth2" require "jwt" module OmniAuth module Strategies class EveOnlineSso < OmniAuth::Strategies::OAuth2 option :name, "eve_online_sso" option :client_options, authorize_url: "/v2/oauth/authorize", token_url: "/v2/oauth/token", site: "https://login.eveonline.com/" uid { raw_info["character_id"] } info do { name: raw_info["name"], character_id: raw_info["character_id"], expires_on: raw_info["expires_on"], scopes: raw_info["scopes"], token_type: raw_info["token_type"], character_owner_hash: raw_info["owner"] } end extra do { raw_info: raw_info } end def raw_info @raw_info ||= JWT.decode(access_token.token, nil, false) .find { |element| element.key?("scp") }.tap do |hash| hash["character_id"] = hash["sub"].split(":")[-1] hash["scopes"] = [*hash["scp"]].join(" ") hash["token_type"] = hash["sub"].split(":")[0].capitalize hash["expires_on"] = hash["exp"] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omniauth-eve_online-sso-0.7.0 | lib/omniauth/strategies/eve_online_sso.rb |
omniauth-eve_online-sso-0.6.0 | lib/omniauth/strategies/eve_online_sso.rb |