class Stormpath::Authentication::HttpBearerAuthentication

Constants

BEARER_PATTERN

Attributes

application[R]
authorization_header[R]
local[R]

Public Class Methods

new(application, authorization_header, options = {}) click to toggle source
   # File lib/stormpath-sdk/auth/http_bearer_authentication.rb
 7 def initialize(application, authorization_header, options = {})
 8   @application = application
 9   @authorization_header = authorization_header
10   @local = options[:local] || false
11   raise Stormpath::Error if authorization_header.nil?
12 end

Public Instance Methods

authenticate!() click to toggle source
   # File lib/stormpath-sdk/auth/http_bearer_authentication.rb
14 def authenticate!
15   Stormpath::Oauth::VerifyAccessToken.new(application, local: local)
16                                      .verify(bearer_access_token)
17 end

Private Instance Methods

bearer_access_token() click to toggle source
   # File lib/stormpath-sdk/auth/http_bearer_authentication.rb
21 def bearer_access_token
22   raise Stormpath::Error unless authorization_header =~ BEARER_PATTERN
23   authorization_header.gsub(BEARER_PATTERN, '')
24 end