Class: RoadForest::Authorization::AuthEntity
- Inherits:
-
Object
- Object
- RoadForest::Authorization::AuthEntity
- Defined in:
- lib/roadforest/authorization.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.
166 167 168 |
# File 'lib/roadforest/authorization.rb', line 166 def initialize @authenticated = false end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
169 170 171 |
# File 'lib/roadforest/authorization.rb', line 169 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
169 170 171 |
# File 'lib/roadforest/authorization.rb', line 169 def token @token end |
#username ⇒ Object
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
171 172 173 |
# File 'lib/roadforest/authorization.rb', line 171 def authenticated? !!@authenticated end |