Module: Descope::Api::V1::Management::SSOApplication

Includes:
Common
Included in:
Descope::Api::V1::Management
Defined in:
lib/descope/api/v1/management/sso_application.rb

Overview

Management API calls

Constant Summary

Constants included from Common

Common::ACCESS_KEYS_SEARCH_PATH, Common::ACCESS_KEY_ACTIVATE_PATH, Common::ACCESS_KEY_CREATE_PATH, Common::ACCESS_KEY_DEACTIVATE_PATH, Common::ACCESS_KEY_DELETE_PATH, Common::ACCESS_KEY_LOAD_PATH, Common::ACCESS_KEY_UPDATE_PATH, Common::AUDIT_CREATE_EVENT, Common::AUDIT_SEARCH, Common::AUTHZ_NS_DELETE, Common::AUTHZ_NS_SAVE, Common::AUTHZ_RD_DELETE, Common::AUTHZ_RD_SAVE, Common::AUTHZ_RE_CREATE, Common::AUTHZ_RE_DELETE, Common::AUTHZ_RE_DELETE_RESOURCES, Common::AUTHZ_RE_HAS_RELATIONS, Common::AUTHZ_RE_RESOURCE, Common::AUTHZ_RE_TARGETS, Common::AUTHZ_RE_TARGET_ALL, Common::AUTHZ_RE_WHO, Common::AUTHZ_SCHEMA_DELETE, Common::AUTHZ_SCHEMA_LOAD, Common::AUTHZ_SCHEMA_SAVE, Common::FLOW_EXPORT_PATH, Common::FLOW_IMPORT_PATH, Common::FLOW_LIST_PATH, Common::GROUP_LOAD_ALL_FOR_MEMBER_PATH, Common::GROUP_LOAD_ALL_GROUP_MEMBERS_PATH, Common::GROUP_LOAD_ALL_PATH, Common::PASSWORD_SETTINGS_PATH, Common::PERMISSION_CREATE_PATH, Common::PERMISSION_DELETE_PATH, Common::PERMISSION_LOAD_ALL_PATH, Common::PERMISSION_UPDATE_PATH, Common::PROJECT_CLONE, Common::PROJECT_DELETE_PATH, Common::PROJECT_EXPORT_PATH, Common::PROJECT_IMPORT_PATH, Common::PROJECT_UPDATE_NAME, Common::ROLE_CREATE_PATH, Common::ROLE_DELETE_PATH, Common::ROLE_LOAD_ALL_PATH, Common::ROLE_SEARCH_PATH, Common::ROLE_UPDATE_PATH, Common::SCIM_GROUPS_PATH, Common::SCIM_RESOURCE_TYPES_PATH, Common::SCIM_SERVICE_PROVIDER_CONFIG_PATH, Common::SCIM_USERS_PATH, Common::SSO_APPLICATION_DELETE_PATH, Common::SSO_APPLICATION_LOAD_ALL_PATH, Common::SSO_APPLICATION_LOAD_PATH, Common::SSO_APPLICATION_OIDC_CREATE_PATH, Common::SSO_APPLICATION_OIDC_UPDATE_PATH, Common::SSO_APPLICATION_SAML_CREATE_PATH, Common::SSO_APPLICATION_SAML_UPDATE_PATH, Common::SSO_CONFIGURE_OIDC_SETTINGS_PATH, Common::SSO_CONFIGURE_SAML_METADATA_PATH, Common::SSO_CONFIGURE_SAML_SETTINGS_PATH, Common::SSO_LOAD_SETTINGS_PATH, Common::SSO_MAPPING_PATH, Common::SSO_METADATA_PATH, Common::SSO_OIDC_PATH, Common::SSO_SETTINGS_PATH, Common::TENANT_CREATE_PATH, Common::TENANT_DELETE_PATH, Common::TENANT_LOAD_ALL_PATH, Common::TENANT_LOAD_PATH, Common::TENANT_SEARCH_ALL_PATH, Common::TENANT_UPDATE_PATH, Common::TEST_USERS_SEARCH_PATH, Common::TEST_USER_CREATE_PATH, Common::THEME_EXPORT_PATH, Common::THEME_IMPORT_PATH, Common::UPDATE_JWT_PATH, Common::USERS_SEARCH_PATH, Common::USER_ADD_ROLE_PATH, Common::USER_ADD_TENANT_PATH, Common::USER_CREATE_BATCH_PATH, Common::USER_CREATE_PATH, Common::USER_DELETE_ALL_TEST_USERS_PATH, Common::USER_DELETE_PATH, Common::USER_EXPIRE_PASSWORD_PATH, Common::USER_GENERATE_EMBEDDED_LINK_PATH, Common::USER_GENERATE_ENCHANTED_LINK_FOR_TEST_PATH, Common::USER_GENERATE_MAGIC_LINK_FOR_TEST_PATH, Common::USER_GENERATE_OTP_FOR_TEST_PATH, Common::USER_GET_PROVIDER_TOKEN, Common::USER_LOAD_PATH, Common::USER_LOGOUT_PATH, Common::USER_PATCH_PATH, Common::USER_REMOVE_ROLE_PATH, Common::USER_REMOVE_TENANT_PATH, Common::USER_SEARCH_PATH, Common::USER_SET_ACTIVE_PASSWORD_PATH, Common::USER_SET_PASSWORD_PATH, Common::USER_SET_TEMPORARY_PASSWORD_PATH, Common::USER_UPDATE_CUSTOM_ATTRIBUTE_PATH, Common::USER_UPDATE_EMAIL_PATH, Common::USER_UPDATE_LOGIN_ID_PATH, Common::USER_UPDATE_NAME_PATH, Common::USER_UPDATE_PATH, Common::USER_UPDATE_PHONE_PATH, Common::USER_UPDATE_PICTURE_PATH, Common::USER_UPDATE_STATUS_PATH

Instance Method Summary collapse

Methods included from Common

#associated_tenants_to_hash_array

Instance Method Details

#create_saml_application(name: nil, login_page_url: nil, id: nil, description: nil, logo: nil, enabled: nil, use_metadata_info: nil, metadata_url: nil, entity_id: nil, acs_url: nil, certificate: nil, attribute_mapping: nil, groups_mapping: nil, acs_allowed_callbacks: nil, subject_name_id_type: nil, subject_name_id_format: nil, default_relay_state: nil, force_authentication: nil, logout_redirect_url: nil) ⇒ Object

rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/descope/api/v1/management/sso_application.rb', line 25

def create_saml_application(
  name: nil,
  login_page_url: nil,
  id: nil,
  description: nil,
  logo: nil,
  enabled: nil,
  use_metadata_info: nil,
  metadata_url: nil,
  entity_id: nil,
  acs_url: nil,
  certificate: nil,
  attribute_mapping: nil,
  groups_mapping: nil,
  acs_allowed_callbacks: nil,
  subject_name_id_type: nil,
  subject_name_id_format: nil,
  default_relay_state: nil,
  force_authentication: nil,
  logout_redirect_url: nil
)
  # Create a new SAML sso application with the given name. SSO application IDs are provisioned automatically,
  # but can be provided explicitly if needed. Both the name and ID must be unique per project.

  if 
    raise Descope::ArgumentException.new('metadata_url argument must be set', code: 400) unless 
  else
    unless entity_id && acs_url && certificate
      raise Descope::ArgumentException.new('entity_id, acs_url, certificate arguments must be set', code: 400)
    end
  end

  attribute_mapping ||= []
  groups_mapping ||= []
  acs_allowed_callbacks ||= []
  body = compose_create_update_saml_body(
    name:,
    login_page_url:,
    id:,
    description:,
    enabled:,
    logo:,
    use_metadata_info:,
    metadata_url:,
    entity_id:,
    acs_url:,
    certificate:,
    attribute_mapping:,
    groups_mapping:,
    acs_allowed_callbacks:,
    subject_name_id_type:,
    subject_name_id_format:,
    default_relay_state:,
    force_authentication:,
    logout_redirect_url:
  )
  post(SSO_APPLICATION_SAML_CREATE_PATH, body)
end

#create_sso_oidc_app(id: nil, name: nil, description: nil, enabled: nil, logo: nil, login_page_url: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/descope/api/v1/management/sso_application.rb', line 11

def create_sso_oidc_app(id: nil, name: nil, description: nil, enabled: nil, logo: nil, login_page_url: nil)
  # Create a new OIDC sso application with the given name. SSO application IDs are provisioned automatically,
  # but can be provided explicitly if needed. Both the name and ID must be unique per project.
  body = {}
  body[:id] = id if id
  body[:name] = name if name
  body[:description] = description if description
  body[:enabled] = enabled if enabled
  body[:logo] =  if 
  body[:loginPageUrl] =  if 
  post(SSO_APPLICATION_OIDC_CREATE_PATH, body)
end

#delete_sso_app(id) ⇒ Object



149
150
151
152
# File 'lib/descope/api/v1/management/sso_application.rb', line 149

def delete_sso_app(id)
  # Delete an existing sso application. IMPORTANT: This operation is irreversible. Use carefully.
  delete(SSO_APPLICATION_DELETE_PATH, { id: })
end

#load_all_sso_appsObject



159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/descope/api/v1/management/sso_application.rb', line 159

def load_all_sso_apps
  # Load all sso applications.
  #
  #   Return value:
  #        {
  #           "apps": [
  #                   {"id":"app1","name":"<name>","description":"<description>","enabled":true,"logo":"","appType":"saml","samlSettings":{"loginPageUrl":"","idpCert":"<cert>","useMetadataInfo":true,"metadataUrl":"","entityId":"","acsUrl":"","certificate":"","attributeMapping":[{"name":"email","type":"","value":"attrVal1"}],"groupsMapping":[{"name":"grp1","type":"","filterType":"roles","value":"","roles":[{"id":"myRoleId","name":"myRole"}]}],"idpMetadataUrl":"","idpEntityId":"","idpSsoUrl":"","acsAllowedCallbacks":[],"subjectNameIdType":"","subjectNameIdFormat":"", "defaultRelayState":"", "forceAuthentication": false, "idpLogoutUrl": "", "logoutRedirectUrl": ""},"oidcSettings":{"loginPageUrl":"","issuer":"","discoveryUrl":"", "forceAuthentication":false}},
  #           {"id":"app2","name":"<name>","description":"<description>","enabled":true,"logo":"","appType":"saml","samlSettings":{"loginPageUrl":"","idpCert":"<cert>","useMetadataInfo":true,"metadataUrl":"","entityId":"","acsUrl":"","certificate":"","attributeMapping":[{"name":"email","type":"","value":"attrVal1"}],"groupsMapping":[{"name":"grp1","type":"","filterType":"roles","value":"","roles":[{"id":"myRoleId","name":"myRole"}]}],"idpMetadataUrl":"","idpEntityId":"","idpSsoUrl":"","acsAllowedCallbacks":[],"subjectNameIdType":"","subjectNameIdFormat":"", "defaultRelayState":"", "forceAuthentication": false, "idpLogoutUrl": "", "logoutRedirectUrl": ""},"oidcSettings":{"loginPageUrl":"","issuer":"","discoveryUrl":"", "forceAuthentication":false}}
  #           ]
  #       }
  #   Containing the loaded sso applications information.
  get(SSO_APPLICATION_LOAD_ALL_PATH, {})
end

#load_sso_app(id) ⇒ Object



154
155
156
157
# File 'lib/descope/api/v1/management/sso_application.rb', line 154

def load_sso_app(id)
  # Load an existing sso application.
  get(SSO_APPLICATION_LOAD_PATH, { id: })
end

#update_saml_application(id: nil, name: nil, login_page_url: nil, description: nil, logo: nil, enabled: nil, use_metadata_info: nil, metadata_url: nil, entity_id: nil, acs_url: nil, certificate: nil, attribute_mapping: nil, groups_mapping: nil, acs_allowed_callbacks: nil, subject_name_id_type: nil, subject_name_id_format: nil, default_relay_state: nil, force_authentication: nil, logout_redirect_url: nil) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/descope/api/v1/management/sso_application.rb', line 91

def update_saml_application(
  id: nil,
  name: nil,
  login_page_url: nil,
  description: nil,
  logo: nil,
  enabled: nil,
  use_metadata_info: nil,
  metadata_url: nil,
  entity_id: nil,
  acs_url: nil,
  certificate: nil,
  attribute_mapping: nil,
  groups_mapping: nil,
  acs_allowed_callbacks: nil,
  subject_name_id_type: nil,
  subject_name_id_format: nil,
  default_relay_state: nil,
  force_authentication: nil,
  logout_redirect_url: nil
)
  # Update an existing SAML sso application with the given parameters. IMPORTANT: All parameters are used as overrides
  # to the existing sso application. Empty fields will override populated fields. Use carefully.

  if 
    raise 'metadata_url argument must be set' unless 
  else
    raise 'entity_id, acs_url, certificate arguments must be set' unless entity_id && acs_url
  end

  attribute_mapping ||= []
  groups_mapping ||= []
  acs_allowed_callbacks ||= []

  body = compose_create_update_saml_body(
    name:,
    login_page_url:,
    id:,
    description:,
    enabled:,
    logo:,
    use_metadata_info:,
    metadata_url:,
    entity_id:,
    acs_url:,
    certificate:,
    attribute_mapping:,
    groups_mapping:,
    acs_allowed_callbacks:,
    subject_name_id_type:,
    subject_name_id_format:,
    default_relay_state:,
    force_authentication:,
    logout_redirect_url:
  )
  post(SSO_APPLICATION_SAML_UPDATE_PATH, body)
end

#update_sso_oidc_app(id: nil, name: nil, description: nil, enabled: nil, logo: nil, login_page_url: nil, force_authentication: nil) ⇒ Object



84
85
86
87
88
89
# File 'lib/descope/api/v1/management/sso_application.rb', line 84

def update_sso_oidc_app(id: nil, name: nil, description: nil, enabled: nil, logo: nil, login_page_url: nil, force_authentication: nil)
  # Update an existing OIDC sso application with the given parameters. IMPORTANT: All parameters are used as overrides
  # to the existing sso application. Empty fields will override populated fields. Use carefully.
  body = compose_create_update_oidc_body(name, , id, description, enabled, , force_authentication)
  post(SSO_APPLICATION_OIDC_UPDATE_PATH, body)
end