class Rack::OAuth2::Server::Issuer
A third party that issues assertions tools.ietf.org/html/draft-ietf-oauth-assertions-01#section-5.1
Attributes
_id[R]
The unique identifier of this Issuer
. String or URI
hmac_secret[R]
shared secret used for verifying HMAC signatures
identifier[R]
The unique identifier of this Issuer
. String or URI
notes[R]
notes about this Issuer
public_key[R]
public key used for verifying RSA signatures
Public Class Methods
collection()
click to toggle source
# File lib/rack/oauth2/models/issuer.rb, line 28 def collection prefix = Server.options[:collection_prefix] Server.database["#{prefix}.issuers"] end
create(args)
click to toggle source
Create a new Issuer
.
# File lib/rack/oauth2/models/issuer.rb, line 15 def create(args) fields = {} [:hmac_secret, :public_key, :notes].each do |key| fields[key] = args[key] if args.has_key?(key) end fields[:created_at] = Time.now.to_i fields[:updated_at] = Time.now.to_i fields[:_id] = args[:identifier] collection.insert(fields, :safe=>true) Server.new_instance self, fields end
from_identifier(identifier)
click to toggle source
returns the Issuer
object for the given identifier
# File lib/rack/oauth2/models/issuer.rb, line 10 def from_identifier(identifier) Server.new_instance self, collection.find_one({:_id=>identifier}) end
Public Instance Methods
update(args)
click to toggle source
# File lib/rack/oauth2/models/issuer.rb, line 45 def update(args) fields = [:hmac_secret, :public_key, :notes].inject({}) {|h,k| v = args[k]; h[k] = v if v; h} self.class.collection.update({:_id => identifier }, {:$set => fields}) self.class.from_identifier(identifier) end