module Agilix::Buzz::Commands::Authentication

Public Instance Methods

compute_hmac(options = {}) click to toggle source

This requires a key to exist with the given keyname, see putkey not sure what its used for yet api.compute_hmac

# File lib/agilix/buzz/commands/authentication.rb, line 139
def compute_hmac(options = {})
  options = argument_cleaner(required_params: %i( domainid keyname message ), optional_params: %i( algorithm format ), options: options )
  options[:message] = "$VAR_USERID#{options[:message]}$VAR_SECRETTime$VAR_TIME"
  authenticated_get cmd: "computeHMAC", **options
end
extend_session() click to toggle source

This is handled automatically by instantiation of a base Agilix::Buzz::Api instance and on subsequent calls to the api through the check_authentication method api.extend_session

# File lib/agilix/buzz/commands/authentication.rb, line 23
def extend_session
  response = authenticated_post cmd: "extendsession", bypass_authentication_check: true
  @token_expiration = set_token_expiration(response.dig("response", "session", "authenticationexpirationminutes"))
  authenticate! if response.dig("response", "code") == "NoAuthentication"
  response
end
force_password_change(options = {}) click to toggle source

api.force_password_change userid: 57181

# File lib/agilix/buzz/commands/authentication.rb, line 31
def force_password_change(options = {})
  options = argument_cleaner(required_params: %i( userid ), optional_params: %i( ), options: options )
  authenticated_post cmd: "forcepasswordchange", **options
end
get_key(options = {}) click to toggle source

api.get_key entityid: 57031, name: 'secret_key_1'

# File lib/agilix/buzz/commands/authentication.rb, line 131
def get_key(options = {})
  options = argument_cleaner(required_params: %i( entityid name ), optional_params: %i( ), options: options )
  authenticated_get cmd: "getkey", **options
end
get_password_login_attempt_history(options = {}) click to toggle source

api.get_password_login_attempt_history userid: 57181 api.get_password_login_attempt_history userid: 57181, earliestrecordtoreturn: '2018-01-01'

# File lib/agilix/buzz/commands/authentication.rb, line 38
def get_password_login_attempt_history(options = {})
  options = argument_cleaner(required_params: %i( userid ), optional_params: %i( earliestrecordtoreturn ), options: options )
  authenticated_get cmd: "getpasswordloginattempthistory", **options
end
get_password_policy(options = {}) click to toggle source

api.get_password_policy api.get_password_policy domainid: 57031

# File lib/agilix/buzz/commands/authentication.rb, line 45
def get_password_policy(options = {})
  options = argument_cleaner(required_params: %i(  ), optional_params: %i( domainid bypasscache ), options: options )
  authenticated_get cmd: "getpasswordpolicy", **options
end
get_password_question(options = {}) click to toggle source

api.get_password_question username: “auto-tests/BuzzUserUp1”

# File lib/agilix/buzz/commands/authentication.rb, line 51
def get_password_question(options = {})
  options = argument_cleaner(required_params: %i( username ), optional_params: %i( ), options: options )
  authenticated_get cmd: "getpasswordquestion", **options
end
login(username: , password: , domain: )
Alias for: login2
login2(username: , password: , domain: ) click to toggle source

This is handled automatically by instantiation of a base Agilix::Buzz::Api instance. It wouldn't need to be called manually unless using for other users or making calls on their behalf api.login username: 'my-username', password: 'my-password', domain: 'my-domain'

# File lib/agilix/buzz/commands/authentication.rb, line 8
def login2(username: , password: , domain: )
  post cmd: "login2", username: "#{domain}/#{username}", password: password
end
Also aliased as: login
logout() click to toggle source

api.logout

# File lib/agilix/buzz/commands/authentication.rb, line 14
def logout
  response = authenticated_get cmd: "logout"
  @token = nil
  @token_expiration = nil
  response
end
proxy(options = {}) click to toggle source

api.proxy userid: 57181

# File lib/agilix/buzz/commands/authentication.rb, line 64
def proxy(options = {})
  options = argument_cleaner(required_params: %i( userid ), optional_params: %i( noazt ), options: options )
  options[:noazt] ||= true
  authenticated_post cmd: "proxy", **options
end
proxy_api(userid: ) click to toggle source

proxy_api = api.proxy_api userid: 57181

# File lib/agilix/buzz/commands/authentication.rb, line 79
def proxy_api(userid: )
  response = proxy userid: userid
  self.class.new username: response.dig('response', 'user', 'username'), token: response.dig('response', 'user', 'token'), domain: response.dig('response', 'user', 'userspace'), token_expiration: set_token_expiration(response.dig('response', 'user', 'authenticationexpirationminutes'))
end
put_key(options = {}) click to toggle source

ISSUE: This should be a POST method as it's storing data api.put_key entityid: 57031, name: 'secret_key_1', value: “Super Secret”

# File lib/agilix/buzz/commands/authentication.rb, line 125
def put_key(options = {})
  options = argument_cleaner(required_params: %i( entityid name value ), optional_params: %i( ), options: options )
  authenticated_get cmd: "putkey", **options
end
reset_lockout(options = {}) click to toggle source

api.reset_lockout userid: 57181

# File lib/agilix/buzz/commands/authentication.rb, line 106
def reset_lockout(options = {})
  options = argument_cleaner(required_params: %i( userid ), optional_params: %i( ), options: options )
  authenticated_post cmd: "resetlockout", **options
end
reset_password(options = {}) click to toggle source
# File lib/agilix/buzz/commands/authentication.rb, line 112
def reset_password(options = {})
  options = argument_cleaner(required_params: %i( username ), optional_params: %i( answer ), options: options )
  authenticated_get cmd: "resetpassword", **options
end
unproxy(options = {}) click to toggle source

proxy_api = api.proxy_api userid: 57181 proxy_api.unproxy userid: 57181

# File lib/agilix/buzz/commands/authentication.rb, line 72
def unproxy(options = {})
  options = argument_cleaner(required_params: %i( userid ), optional_params: %i( noazt ), options: options )
  authenticated_post cmd: "unproxy", **options
end
update_password(options = {}) click to toggle source

api.update_password userid: 57181, password: “IChanged123”

# File lib/agilix/buzz/commands/authentication.rb, line 118
def update_password(options = {})
  options = argument_cleaner(required_params: %i( userid password ), optional_params: %i( token oldpassword ), options: options )
  authenticated_get cmd: "updatepassword", **options
end
update_password_question_answer(options = {}) click to toggle source

ISSUE: This works with a GET call api.update_password_question_answer userid: 57181, passwordquestion: “Where is your favorite vacation place?”, passwordanswer: “Hawaii”

# File lib/agilix/buzz/commands/authentication.rb, line 58
def update_password_question_answer(options = {})
  options = argument_cleaner(required_params: %i( userid passwordquestion passwordanswer ), optional_params: %i( oldpassword ), options: options )
  authenticated_post cmd: "updatepasswordquestionanswer", **options
end

Private Instance Methods

set_token_expiration(minutes) click to toggle source
# File lib/agilix/buzz/commands/authentication.rb, line 146
def set_token_expiration(minutes)
  Time.now + (minutes.to_i * 60 )
end