Module: Legion::API::Token
- Defined in:
- lib/legion/api/token.rb
Class Method Summary collapse
- .issue_human_token(msid:, name: nil, roles: [], ttl: 28_800) ⇒ Object
- .issue_worker_token(worker_id:, owner_msid:, ttl: 3600) ⇒ Object
- .signing_key ⇒ Object
Class Method Details
.issue_human_token(msid:, name: nil, roles: [], ttl: 28_800) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/legion/api/token.rb', line 15 def self.issue_human_token(msid:, name: nil, roles: [], ttl: 28_800) Legion::Crypt::JWT.issue( { sub: msid, name: name, roles: roles, scope: 'human' }, signing_key: signing_key, ttl: ttl, issuer: 'legion' ) end |
.issue_worker_token(worker_id:, owner_msid:, ttl: 3600) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/legion/api/token.rb', line 6 def self.issue_worker_token(worker_id:, owner_msid:, ttl: 3600) Legion::Crypt::JWT.issue( { worker_id: worker_id, sub: owner_msid, scope: 'worker' }, signing_key: signing_key, ttl: ttl, issuer: 'legion' ) end |