Class: RoadForest::Authorization::AuthEntity
- Inherits:
-
Object
- Object
- RoadForest::Authorization::AuthEntity
- Defined in:
- lib/roadforest/authorization/auth-entity.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#token ⇒ Object
Returns the value of attribute token.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #authenticate! ⇒ Object
- #authenticate_by_password(password) ⇒ Object
- #authenticate_by_token(token) ⇒ Object
- #authenticated? ⇒ Boolean
-
#initialize ⇒ AuthEntity
constructor
A new instance of AuthEntity.
Constructor Details
#initialize ⇒ AuthEntity
Returns a new instance of AuthEntity.
4 5 6 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 4 def initialize @authenticated = false end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 7 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 7 def token @token end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 7 def username @username end |
Instance Method Details
#authenticate! ⇒ Object
21 22 23 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 21 def authenticate! @authenticated = true end |
#authenticate_by_password(password) ⇒ Object
13 14 15 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 13 def authenticate_by_password(password) @authenticated = (!password.nil? and password == @password) end |
#authenticate_by_token(token) ⇒ Object
17 18 19 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 17 def authenticate_by_token(token) @authenticated = (!token.nil? and token == @token) end |
#authenticated? ⇒ Boolean
9 10 11 |
# File 'lib/roadforest/authorization/auth-entity.rb', line 9 def authenticated? !!@authenticated end |