Sha256: 8743ad777c4aac81c7c4283f9f902c8dd5f5fd49dd9af0dd1828a3a1a89efb8e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module G5AuthenticatableApi module Services class TokenInfo attr_reader :params, :headers, :warden def initialize(params={},headers={},warden=nil) @params = params || {} @headers = headers || {} @warden = warden end def access_token @access_token ||= (extract_token_from_header || params['access_token'] || warden.try(:user).try(:g5_access_token)) end def token_data auth_client.token_info end def auth_client @auth_client ||= G5AuthenticationClient::Client.new(allow_password_credentials: 'false', access_token: access_token) end private def extract_token_from_header if authorization_header parts = authorization_header.match(/Bearer (?<access_token>\S+)/) parts['access_token'] end end def authorization_header @headers['Authorization'] || @headers['AUTHORIZATION'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
g5_authenticatable_api-0.4.1 | lib/g5_authenticatable_api/services/token_info.rb |
g5_authenticatable_api-0.4.0 | lib/g5_authenticatable_api/services/token_info.rb |