Skip to content

Conversation

@avsamele
Copy link

@avsamele avsamele commented Mar 3, 2025

This pull request includes multiple updates to the lib/onelogin/api/util/constants.rb file, mainly focusing on updating API endpoint URLs to version 2 and adding new endpoints. The key changes are grouped into updates to existing URLs and the addition of new URLs.

Updates to existing URLs:

  • Updated user-related URLs to use API version 2 (GET_USERS_URL, GET_USER_URL, GET_APPS_FOR_USER_URL, GET_CUSTOM_ATTRIBUTES_URL, CREATE_USER_URL, UPDATE_USER_URL, DELETE_USER_URL).
  • Updated role-related URLs to use API version 2 (GET_ROLES_URL, CREATE_ROLE_URL, GET_ROLE_URL).
  • Updated SAML assertion URLs to use API version 2 (GET_SAML_ASSERTION_URL, GET_SAML_VERIFY_FACTOR).
  • Updated multi-factor authentication URLs to use API version 2 (GET_FACTORS_URL, ENROLL_FACTOR_URL, GET_ENROLLED_FACTORS_URL, ACTIVATE_FACTOR_URL, REMOVE_FACTOR_URL).

Addition of new URLs:

  • Added custom attribute-related URLs (GET_CUSTOM_ATTRIBUTE, CREATE_CUSTOM_ATTRIBUTE, UPDATE_CUSTOM_ATTRIBUTE, DELETE_CUSTOM_ATTRIBUTE).
  • Added new role-related URLs (UPDATE_ROLES_URL, DELETE_ROLES_URL, GET_APPS_ROLE_URL, SET_APPS_ROLE_URL, GET_ROLE_FOR_USERS_URL, ADD_ROLE_FOR_USERS_URL, REMOVE_ROLE_FOR_USERS_URL, GET_ROLE_FOR_ADMINS_URL, ADD_ROLE_FOR_ADMINS_URL, REMOVE_ROLE_FOR_ADMINS_URL).
  • Added new reports-related URLs (LIST_REPORTS_URL, RUN_REPORTS_URL, RUN_BACKGROUND_REPORTS_URL).
  • Added new API authorization URLs (CREATE_AUTHORIZATION_SERVER_URL, LIST_AUTHORIZATION_SERVER_URL, GET_AUTHORIZATION_SERVER_URL, UPDATE_AUTHORIZATION_SERVER_URL, DELETE_AUTHORIZATION_SERVER_URL, ADD_ACCESS_TOKEN_CLAIMS_URL, LIST_ACCESS_TOKEN_CLAIMS_URL, UPDATE_ACCESS_TOKEN_CLAIMS_URL, DELETE_ACCESS_TOKEN_CLAIMS_URL, ADD_SCOPE_URL, LIST_SCOPE_URL, UPDATE_SCOPE_URL, DELETE_SCOPE_URL, ADD_CLIENTS_APPS_URL, LIST_CLIENTS_APPS_URL, UPDATE_CLIENTS_APPS_URL, DELETE_CLIENTS_APPS_URL).
  • Added new smart hooks URLs (GET_SMART_HOOK_URL, LIST_SMART_HOOKS_URL, GET_SMART_HOOK_LOGS_URL, CREATE_SMART_HOOK_URL, UPDATE_SMART_HOOK_URL, DELETE_SMART_HOOK_URL, CREATE_ENV_VAR_HOOK_URL, GET_ENV_VAR_HOOK_URL, UPDATE_ENV_VAR_HOOK_URL, DELETE_ENV_VAR_HOOK_URL, LIST_ENV_VAR_HOOKS_URL).
  • Added new user mapping URLs (GET_USER_MAPPING_URL, LIST_USER_MAPPING_URL, CREATE_USER_MAPPING_URL, UPDATE_USER_MAPPING_URL, DELETE_USER_MAPPING_URL, DRY_RUN_USER_MAPPING_URL, LIST_USER_MAPPING_CONDITION_URL, LIST_USER_MAPPING_CONDITION_OPTS_URL, LIST_USER_MAPPING_CONDITION_VALS_URL, LIST_USER_MAPPING_ACTIONS_URL, LIST_USER_MAPPING_ACTIONS_VAL_URL, BULK_SORT_USER_MAPPING_URL).
  • Added new vigilance AI URLs (GET_RISK_RULES_URL, LIST_RISK_RULES_URL, CREATE_RISK_RULES_URL, UPDATE_RISK_RULESURL, DELETE_RISK_RULES_URL, GET_RISK_SCORE_URL, GET_RISK_VERIFY_URL, `

@avsamele avsamele requested a review from Subterrane March 3, 2025 12:05
@Subterrane Subterrane requested a review from Copilot March 3, 2025 17:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR updates the API endpoint constants from version 1 to version 2, ensuring that all references use the latest API version.

  • Updated user, role, and custom attribute URLs to API v2
  • Added new endpoints for Smart MFA, API authorizations, Smart Hooks, User Mappings, Risk Rules, and App Rules
  • Commented out legacy MFA endpoints and replaced them with their API v2 counterparts

Reviewed Changes

File Description
lib/onelogin/api/util/constants.rb Refactored numerous API endpoints to align with API v2

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

lib/onelogin/api/util/constants.rb:158

  • The constant 'UPDATE_RISK_RULESURL' appears to have a typo. For consistency with the naming of other constants, consider renaming it to 'UPDATE_RISK_RULES_URL'.
UPDATE_RISK_RULESURL = "https://api.%s.onelogin.com/api/2/risk/rules/%s"

@Subterrane
Copy link

lib/onelogin/api/client.rb is getting quite large. Can we refactor this into smaller chunks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants