Sha256: 5ba5146b5a95f49fe27ccdfe432b9dc4516d6ae6e95d2aa9ad917401aa0947cf
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'keratin/client' require 'net/http' module Keratin::AuthN class Issuer < Keratin::Client def update(account_id, username:) patch(path: "/accounts/#{account_id}", body: { username: username }).result end def lock(account_id) patch(path: "/accounts/#{account_id}/lock").result end def unlock(account_id) patch(path: "/accounts/#{account_id}/unlock").result end def archive(account_id) delete(path: "/accounts/#{account_id}").result end # returns account_id or raises exception def import(username:, password:, locked: false) post(path: '/accounts/import', body: { username: username, password: password, locked: locked }).result['id'] end def expire_password(account_id) patch(path: "/accounts/#{account_id}/expire_password") end def signing_key(kid) keys.find{|k| k['use'] == 'sig' && (kid.blank? || kid == k['kid']) } end private def configuration @configuration ||= get(path: '/configuration').data end private def keys JSON::JWK::Set.new( JSON.parse( Net::HTTP.get(URI.parse(configuration['jwks_uri'])) ) ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
keratin-authn-0.6.1 | lib/keratin/authn/issuer.rb |
keratin-authn-0.6.0 | lib/keratin/authn/issuer.rb |