Class: Bsm::Sso::Client::Strategies::HttpAuth

Inherits:
Base
  • Object
show all
Defined in:
lib/bsm/sso/client/strategies/http_auth.rb

Instance Method Summary collapse

Methods inherited from Base

#user_class

Instance Method Details

#authenticate!Object



11
12
13
14
# File 'lib/bsm/sso/client/strategies/http_auth.rb', line 11

def authenticate!
  u = user_class.sso_authorize(token)
  u.nil? ? fail!(:invalid) : success!(u)
end

#store?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/bsm/sso/client/strategies/http_auth.rb', line 3

def store?
  false
end

#tokenObject



16
17
18
19
20
# File 'lib/bsm/sso/client/strategies/http_auth.rb', line 16

def token
  return nil unless request.authorization && request.authorization =~ /^Basic (.*)/m

  @token ||= Base64.decode64(Regexp.last_match(1)).split(/:/, 2).first
end

#valid?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/bsm/sso/client/strategies/http_auth.rb', line 7

def valid?
  token.present?
end