Class: OmniAuth::Strategies::EVEOnline
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::EVEOnline
- Defined in:
- lib/omniauth/strategies/eve_online.rb
Overview
EVE Online OAuth 2.0 strategy for OmniAuth.
Instance Method Summary collapse
- #character_id ⇒ Object
- #data ⇒ Object
- #http ⇒ Object
- #jwks ⇒ Object
- #jwt ⇒ Object
- #metadata ⇒ Object
Instance Method Details
#character_id ⇒ Object
44 45 46 |
# File 'lib/omniauth/strategies/eve_online.rb', line 44 def character_id data["sub"].split(":")[-1].to_i end |
#data ⇒ Object
48 49 50 |
# File 'lib/omniauth/strategies/eve_online.rb', line 48 def data jwt.find { |e| e.key?("jti") } end |
#http ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/omniauth/strategies/eve_online.rb', line 60 def http @http ||= begin uri = URI.parse("https://login.eveonline.com") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http end end |
#jwks ⇒ Object
52 53 54 |
# File 'lib/omniauth/strategies/eve_online.rb', line 52 def jwks @jwks ||= JSON.parse(http.get(["jwks_uri"]).body) end |
#jwt ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/omniauth/strategies/eve_online.rb', line 34 def jwt @jwt ||= JWT.decode( access_token.token, nil, true, algorithm: "RS256", jwks: jwks, verify_aud: true, aud: "EVE Online", verify_iss: true, iss: ["issuer"] ) end |
#metadata ⇒ Object
56 57 58 |
# File 'lib/omniauth/strategies/eve_online.rb', line 56 def @metadata ||= JSON.parse(http.get("/.well-known/oauth-authorization-server").body) end |