Class: T2Server::HttpBasic

Inherits:
HttpCredentials show all
Defined in:
lib/t2-server/net/credentials.rb

Overview

A class representing HTTP Basic credentials.

Instance Attribute Summary

Attributes inherited from HttpCredentials

#username

Instance Method Summary collapse

Methods inherited from HttpCredentials

#inspect, #to_s

Constructor Details

#initialize(username, password) ⇒ HttpBasic

Create a set of credentials with the supplied username and password.



71
72
73
# File 'lib/t2-server/net/credentials.rb', line 71

def initialize(username, password)
  super(username, password)
end

Instance Method Details

#authenticate(request) ⇒ Object

:call-seq:

authenticate(request)

Authenticate the supplied HTTP request with the credentials held within this class.



80
81
82
# File 'lib/t2-server/net/credentials.rb', line 80

def authenticate(request)
  request.basic_auth @username, @password
end