Class: Masks::Credentials::Key
Overview
Checks :key given a valid Authorization header.
Instance Method Summary
collapse
#backup!, #check, checks, #cleanup, #cleanup!, #mask!, #name, #patch_params, #slug
Instance Method Details
#backup ⇒ Object
33
34
35
|
# File 'app/models/masks/credentials/key.rb', line 33
def backup
session.(:key).touch(:accessed_at) if session&.passed? && accessed
end
|
#lookup ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/models/masks/credentials/key.rb', line 11
def lookup
secret = session.request.authorization&.split&.last
key = session.config.find_key(session, secret:)
return unless key
session.(key:)
session.scoped = key
self.accessed = true
key.actor
end
|
#maskup ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'app/models/masks/credentials/key.rb', line 23
def maskup
key = session.(:key)
if key&.actor == session&.actor && session.scoped == key
approve!
else
deny!
end
end
|