class T2Server::HttpCredentials

This class serves as a base class for concrete HTTP credential systems.

Instances of this class cannot be used to authenticate a connection; please use HttpBasic instead.



The username held by these credentials.

Public Class Methods

parse(userinfo) → Credentials click to toggle source

Parse a typical userinfo style string, such as “username:password”, into a credentials object. In this case the credentials would have a username of “username” and a password of “password”.

# File lib/t2-server/net/credentials.rb, line 61
def self.parse(userinfo)
  user, pass = userinfo.split(':', 2)
  new(user, pass)

Public Instance Methods

inspect → string click to toggle source

Override the Kernel#inspect method so that the password is not exposed when it is called.

# File lib/t2-server/net/credentials.rb, line 83
def inspect
  @@to_s.bind(self).call.sub!(/>\z/) {" Username:#{self}>"}
to_s → string click to toggle source

Return a String representation of these credentials. Just the username is returned; the password is kept hidden.

# File lib/t2-server/net/credentials.rb, line 71
def to_s