class Restforce::Middleware::Authentication::JWTBearer

Public Instance Methods

params() click to toggle source
# File lib/restforce/middleware/authentication/jwt_bearer.rb, line 9
def params
  {
    grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
    assertion: jwt_bearer_token
  }
end

Private Instance Methods

claim_set() click to toggle source
# File lib/restforce/middleware/authentication/jwt_bearer.rb, line 22
def claim_set
  {
    iss: @options[:client_id],
    sub: @options[:username],
    aud: @options[:host],
    iat: Time.now.utc.to_i,
    exp: Time.now.utc.to_i + 180
  }
end
jwt_bearer_token() click to toggle source
# File lib/restforce/middleware/authentication/jwt_bearer.rb, line 18
def jwt_bearer_token
  JWT.encode claim_set, private_key, 'RS256'
end
private_key() click to toggle source
# File lib/restforce/middleware/authentication/jwt_bearer.rb, line 32
def private_key
  OpenSSL::PKey::RSA.new(@options[:jwt_key])
end