Class: ProxyAuth::Token

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/proxy_auth/token.rb

Overview

Service token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeToken

Returns a new instance of Token.



10
11
12
# File 'lib/proxy_auth/token.rb', line 10

def initialize
  register_service
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/proxy_auth/token.rb', line 8

def token
  @token
end

Instance Method Details

#register_serviceObject



14
15
16
17
18
# File 'lib/proxy_auth/token.rb', line 14

def register_service
  Thread.new do
    set_token
  end
end

#valid?(token) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/proxy_auth/token.rb', line 20

def valid?(token)
  @token == token
end