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.

Attributes

username[R]

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
61 def self.parse(userinfo)
62   user, pass = userinfo.split(':', 2)
63   new(user, pass)
64 end

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
83 def inspect
84   @@to_s.bind(self).call.sub!(/>\z/) {" Username:#{self}>"}
85 end
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
71 def to_s
72   @username
73 end