class Octo::Authorization

Public Instance Methods

check_api_key() click to toggle source

Check or Generate client apikey

# File lib/octocore/models/enterprise/authorization.rb, line 28
def check_api_key
  if(self.apikey.nil?)
    self.apikey = SecureRandom.hex
  end
end
generate_password() click to toggle source

Check or Generate client password

# File lib/octocore/models/enterprise/authorization.rb, line 35
def generate_password
  if(self.password.nil?)
    self.password = Digest::SHA1.hexdigest(self.username + self.enterprise_id)
  else
    self.password = Digest::SHA1.hexdigest(self.password + self.enterprise_id)
  end
end
kong_delete() click to toggle source

Delete Kong Records

# File lib/octocore/models/enterprise/authorization.rb, line 56
def kong_delete
  delete_consumer(self.username)
end
kong_requests() click to toggle source

Perform Kong Operations after creating client

# File lib/octocore/models/enterprise/authorization.rb, line 44
def kong_requests
  url = '/consumers/'
  payload = {
    username: self.username,
    custom_id: self.enterprise_id
  }

  process_kong_request(url, :PUT, payload)
  create_keyauth( self.username, self.apikey)
end