Class: AuthzController
- Inherits:
-
Rubee::BaseController
- Object
- Rubee::BaseController
- AuthzController
- Defined in:
- lib/tests/controllers/authorizable_test.rb
Constant Summary
Constants included from Rubee::AuthTokenable
Rubee::AuthTokenable::EXPIRE, Rubee::AuthTokenable::KEY
Instance Method Summary collapse
-
#admin_only ⇒ Object
GET /authz/admin_only.
-
#login ⇒ Object
POST /authz/login.
-
#user_only ⇒ Object
GET /authz/user_only.
Methods inherited from Rubee::BaseController
attach_websocket!, #css, #extract_params, #handle_websocket, #headers, #image, #initialize, #js, #params, #render_template, #response_with, #websocket, #websocket_connections
Methods included from Rubee::Authorizable
Methods included from Rubee::AuthTokenable
Methods included from Rubee::Hookable
Constructor Details
This class inherits a constructor from Rubee::BaseController
Instance Method Details
#admin_only ⇒ Object
GET /authz/admin_only
17 18 19 |
# File 'lib/tests/controllers/authorizable_test.rb', line 17 def admin_only response_with(type: :json, object: { ok: :admin_access }) end |
#login ⇒ Object
POST /authz/login
8 9 10 11 12 13 14 |
# File 'lib/tests/controllers/authorizable_test.rb', line 8 def login if authentificate! response_with(type: :json, object: { ok: :ok }, headers: @token_header) else response_with(type: :json, object: { error: 'user unauthenticated' }, status: :unauthenticated) end end |
#user_only ⇒ Object
GET /authz/user_only
22 23 24 |
# File 'lib/tests/controllers/authorizable_test.rb', line 22 def user_only response_with(type: :json, object: { ok: :user_access }) end |