Class: RoadForest::Authorization::AuthEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/roadforest/authorization.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAuthEntity

Returns a new instance of AuthEntity.



166
167
168
# File 'lib/roadforest/authorization.rb', line 166

def initialize
  @authenticated = false
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



169
170
171
# File 'lib/roadforest/authorization.rb', line 169

def password
  @password
end

#tokenObject

Returns the value of attribute token.



169
170
171
# File 'lib/roadforest/authorization.rb', line 169

def token
  @token
end

#usernameObject

Returns the value of attribute username.



169
170
171
# File 'lib/roadforest/authorization.rb', line 169

def username
  @username
end

Instance Method Details

#authenticate!Object



183
184
185
# File 'lib/roadforest/authorization.rb', line 183

def authenticate!
  @authenticated = true
end

#authenticate_by_password(password) ⇒ Object



175
176
177
# File 'lib/roadforest/authorization.rb', line 175

def authenticate_by_password(password)
  @authenticated = (!password.nil? and password == @password)
end

#authenticate_by_token(token) ⇒ Object



179
180
181
# File 'lib/roadforest/authorization.rb', line 179

def authenticate_by_token(token)
  @authenticated = (!token.nil? and token == @token)
end

#authenticated?Boolean

Returns:

  • (Boolean)


171
172
173
# File 'lib/roadforest/authorization.rb', line 171

def authenticated?
  !!@authenticated
end