Class: Mumukit::Login::JWTCurrentUserStore
- Inherits:
-
Object
- Object
- Mumukit::Login::JWTCurrentUserStore
- Defined in:
- lib/mumukit/login/current_user_store.rb
Instance Method Summary collapse
- #authorization_header ⇒ Object
- #clear! ⇒ Object
- #get_uid ⇒ Object
-
#initialize(controller) ⇒ JWTCurrentUserStore
constructor
A new instance of JWTCurrentUserStore.
- #set! ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(controller) ⇒ JWTCurrentUserStore
21 22 23 |
# File 'lib/mumukit/login/current_user_store.rb', line 21 def initialize(controller) @controller = controller end |
Instance Method Details
#authorization_header ⇒ Object
41 42 43 |
# File 'lib/mumukit/login/current_user_store.rb', line 41 def @controller.env['HTTP_AUTHORIZATION'] end |
#clear! ⇒ Object
29 30 31 |
# File 'lib/mumukit/login/current_user_store.rb', line 29 def clear! raise 'JWT tokens are read-only' end |
#get_uid ⇒ Object
25 26 27 |
# File 'lib/mumukit/login/current_user_store.rb', line 25 def get_uid token.uid end |
#set! ⇒ Object
33 34 35 |
# File 'lib/mumukit/login/current_user_store.rb', line 33 def set!(*) raise 'JWT tokens are read-only' end |
#token ⇒ Object
37 38 39 |
# File 'lib/mumukit/login/current_user_store.rb', line 37 def token @token ||= Mumukit::Auth::Token.decode_header().tap(&:verify_client!) end |