|
103 | 103 | account_settings_template_assignment_etag = None |
104 | 104 | account_settings_template_name = 'Python-SDK-Example-AccountSettings-Template-' + now |
105 | 105 |
|
| 106 | +idp_id = None |
| 107 | +idp_etag = None |
| 108 | + |
106 | 109 | iam_id_for_preferences = None |
107 | 110 |
|
108 | 111 |
|
@@ -1985,6 +1988,322 @@ def test_delete_account_settings_template(self): |
1985 | 1988 | except ApiException as e: |
1986 | 1989 | pytest.fail(str(e)) |
1987 | 1990 |
|
| 1991 | + @needscredentials |
| 1992 | + def test_create_idp_example(self): |
| 1993 | + """ |
| 1994 | + create_idp request example |
| 1995 | + """ |
| 1996 | + try: |
| 1997 | + print('\ncreate_idp() result:') |
| 1998 | + # begin-create_idp |
| 1999 | + |
| 2000 | + create_idp_request_properties_idp_model = { |
| 2001 | + 'entity_id': 'http://www.okta.com/abcdefg', |
| 2002 | + 'redirect_binding_url': 'https://trial-12345.okta.com/app/trial-6789/abcdefg/sso/saml', |
| 2003 | + 'want_request_signed': True, |
| 2004 | + } |
| 2005 | + |
| 2006 | + create_idp_request_properties_sp_model = { |
| 2007 | + 'want_assertion_signed': True, |
| 2008 | + 'want_response_signed': True, |
| 2009 | + 'encrypt_response': True, |
| 2010 | + 'idp_initiated_login_enabled': True, |
| 2011 | + 'logout_url_enabled_when_available': True, |
| 2012 | + } |
| 2013 | + |
| 2014 | + create_idp_request_properties_model = { |
| 2015 | + 'idp': create_idp_request_properties_idp_model, |
| 2016 | + 'sp': create_idp_request_properties_sp_model, |
| 2017 | + } |
| 2018 | + |
| 2019 | + create_idp_request_secrets_model = { |
| 2020 | + 'idp': {}, |
| 2021 | + 'sp': {}, |
| 2022 | + } |
| 2023 | + |
| 2024 | + idp = iam_identity_service.create_idp( |
| 2025 | + account_id=account_id, |
| 2026 | + name='Python-SDK-Example-IdP', |
| 2027 | + type='saml', |
| 2028 | + active=True, |
| 2029 | + properties=create_idp_request_properties_model, |
| 2030 | + secrets=create_idp_request_secrets_model, |
| 2031 | + ).get_result() |
| 2032 | + print(json.dumps(idp, indent=2)) |
| 2033 | + |
| 2034 | + # end-create_idp |
| 2035 | + |
| 2036 | + global idp_id |
| 2037 | + idp_id = idp['idp_id'] |
| 2038 | + |
| 2039 | + except ApiException as e: |
| 2040 | + pytest.fail(str(e)) |
| 2041 | + |
| 2042 | + @needscredentials |
| 2043 | + def test_list_idps_example(self): |
| 2044 | + """ |
| 2045 | + list_idps request example |
| 2046 | + """ |
| 2047 | + try: |
| 2048 | + print('\nlist_idps() result:') |
| 2049 | + # begin-list_idps |
| 2050 | + |
| 2051 | + list_idps_response = iam_identity_service.list_idps( |
| 2052 | + account_id=account_id, |
| 2053 | + ).get_result() |
| 2054 | + print(json.dumps(list_idps_response, indent=2)) |
| 2055 | + |
| 2056 | + # end-list_idps |
| 2057 | + |
| 2058 | + except ApiException as e: |
| 2059 | + pytest.fail(str(e)) |
| 2060 | + |
| 2061 | + @needscredentials |
| 2062 | + def test_get_idp_example(self): |
| 2063 | + """ |
| 2064 | + get_idp request example |
| 2065 | + """ |
| 2066 | + try: |
| 2067 | + print('\nget_idp() result:') |
| 2068 | + # begin-get_idp |
| 2069 | + |
| 2070 | + response = iam_identity_service.get_idp(idp_id=idp_id) |
| 2071 | + idp = response.get_result() |
| 2072 | + print(json.dumps(idp, indent=2)) |
| 2073 | + |
| 2074 | + # end-get_idp |
| 2075 | + |
| 2076 | + global idp_etag |
| 2077 | + idp_etag = response.get_headers()['Etag'] |
| 2078 | + |
| 2079 | + except ApiException as e: |
| 2080 | + pytest.fail(str(e)) |
| 2081 | + |
| 2082 | + @needscredentials |
| 2083 | + def test_update_idp_example(self): |
| 2084 | + """ |
| 2085 | + update_idp request example |
| 2086 | + """ |
| 2087 | + try: |
| 2088 | + print('\nupdate_idp() result:') |
| 2089 | + # begin-update_idp |
| 2090 | + |
| 2091 | + update_idp_request_properties_idp_model = { |
| 2092 | + 'entity_id': 'http://www.okta.com/abcdefgijk', |
| 2093 | + 'redirect_binding_url': 'https://trial-12345.okta.com/app/trial-6789/abcdefgijk/sso/saml', |
| 2094 | + 'want_request_signed': False, |
| 2095 | + } |
| 2096 | + |
| 2097 | + update_idp_request_properties_sp_model = { |
| 2098 | + 'want_assertion_signed': False, |
| 2099 | + 'want_response_signed': False, |
| 2100 | + 'encrypt_response': True, |
| 2101 | + 'idp_initiated_login_enabled': False, |
| 2102 | + 'logout_url_enabled_when_available': True, |
| 2103 | + } |
| 2104 | + |
| 2105 | + update_idp_request_properties_model = { |
| 2106 | + 'idp': update_idp_request_properties_idp_model, |
| 2107 | + 'sp': update_idp_request_properties_sp_model, |
| 2108 | + } |
| 2109 | + |
| 2110 | + idp = iam_identity_service.update_idp( |
| 2111 | + idp_id=idp_id, |
| 2112 | + if_match=idp_etag, |
| 2113 | + ui_setup_completed=True, |
| 2114 | + active=True, |
| 2115 | + properties=update_idp_request_properties_model, |
| 2116 | + force_share_scope_update=True, |
| 2117 | + ).get_result() |
| 2118 | + print(json.dumps(idp, indent=2)) |
| 2119 | + |
| 2120 | + # end-update_idp |
| 2121 | + |
| 2122 | + except ApiException as e: |
| 2123 | + pytest.fail(str(e)) |
| 2124 | + |
| 2125 | + @needscredentials |
| 2126 | + def test_list_consumer_accounts_example(self): |
| 2127 | + """ |
| 2128 | + list_consumer_accounts request example |
| 2129 | + """ |
| 2130 | + try: |
| 2131 | + print('\nlist_consumer_accounts() result:') |
| 2132 | + # begin-list_consumer_accounts |
| 2133 | + |
| 2134 | + consumers_response = iam_identity_service.list_consumer_accounts( |
| 2135 | + idp_id=idp_id, |
| 2136 | + ).get_result() |
| 2137 | + print(json.dumps(consumers_response, indent=2)) |
| 2138 | + |
| 2139 | + # end-list_consumer_accounts |
| 2140 | + |
| 2141 | + except ApiException as e: |
| 2142 | + pytest.fail(str(e)) |
| 2143 | + |
| 2144 | + @needscredentials |
| 2145 | + def test_get_login_settings_example(self): |
| 2146 | + """ |
| 2147 | + get_login_settings request example |
| 2148 | + """ |
| 2149 | + try: |
| 2150 | + print('\nget_login_settings() result:') |
| 2151 | + # begin-get_login_settings |
| 2152 | + |
| 2153 | + account_login_settings = iam_identity_service.get_login_settings( |
| 2154 | + account_id=account_id, |
| 2155 | + ).get_result() |
| 2156 | + print(json.dumps(account_login_settings, indent=2)) |
| 2157 | + |
| 2158 | + # end-get_login_settings |
| 2159 | + |
| 2160 | + except ApiException as e: |
| 2161 | + pytest.fail(str(e)) |
| 2162 | + |
| 2163 | + @needscredentials |
| 2164 | + def test_update_login_settings_example(self): |
| 2165 | + """ |
| 2166 | + update_login_settings request example |
| 2167 | + """ |
| 2168 | + try: |
| 2169 | + print('\nupdate_login_settings() result:') |
| 2170 | + # begin-update_login_settings |
| 2171 | + |
| 2172 | + account_login_settings = iam_identity_service.update_login_settings( |
| 2173 | + account_id=account_id, |
| 2174 | + alias='my_alias_update_test', |
| 2175 | + ).get_result() |
| 2176 | + print(json.dumps(account_login_settings, indent=2)) |
| 2177 | + |
| 2178 | + # end-update_login_settings |
| 2179 | + |
| 2180 | + except ApiException as e: |
| 2181 | + pytest.fail(str(e)) |
| 2182 | + |
| 2183 | + @needscredentials |
| 2184 | + def test_list_id_p_settings_example(self): |
| 2185 | + """ |
| 2186 | + list_id_p_settings request example |
| 2187 | + """ |
| 2188 | + try: |
| 2189 | + print('\nlist_id_p_settings() result:') |
| 2190 | + # begin-list_idp_settings |
| 2191 | + |
| 2192 | + list_idp_settings_response = iam_identity_service.list_id_p_settings( |
| 2193 | + account_id=account_id, |
| 2194 | + type='consumable', |
| 2195 | + include_idp_metadata='true', |
| 2196 | + ).get_result() |
| 2197 | + print(json.dumps(list_idp_settings_response, indent=2)) |
| 2198 | + |
| 2199 | + # end-list_idp_settings |
| 2200 | + |
| 2201 | + except ApiException as e: |
| 2202 | + pytest.fail(str(e)) |
| 2203 | + |
| 2204 | + @needscredentials |
| 2205 | + def test_add_id_p_setting_example(self): |
| 2206 | + """ |
| 2207 | + add_id_p_setting request example |
| 2208 | + """ |
| 2209 | + try: |
| 2210 | + print('\nadd_id_p_setting() result:') |
| 2211 | + # begin-add_idp_setting |
| 2212 | + |
| 2213 | + account_idp_settings = iam_identity_service.add_id_p_setting( |
| 2214 | + account_id=account_id, |
| 2215 | + idp_id=idp_id, |
| 2216 | + cloud_user_strategy='STATIC', |
| 2217 | + active=True, |
| 2218 | + ui_default=True, |
| 2219 | + ).get_result() |
| 2220 | + print(json.dumps(account_idp_settings, indent=2)) |
| 2221 | + |
| 2222 | + # end-add_idp_setting |
| 2223 | + |
| 2224 | + except ApiException as e: |
| 2225 | + pytest.fail(str(e)) |
| 2226 | + |
| 2227 | + @needscredentials |
| 2228 | + def test_get_id_p_setting_example(self): |
| 2229 | + """ |
| 2230 | + get_id_p_setting request example |
| 2231 | + """ |
| 2232 | + try: |
| 2233 | + print('\nget_id_p_setting() result:') |
| 2234 | + # begin-get_idp_setting |
| 2235 | + |
| 2236 | + account_idp_settings = iam_identity_service.get_id_p_setting( |
| 2237 | + account_id=account_id, |
| 2238 | + idp_id=idp_id, |
| 2239 | + ).get_result() |
| 2240 | + print(json.dumps(account_idp_settings, indent=2)) |
| 2241 | + |
| 2242 | + # end-get_idp_setting |
| 2243 | + |
| 2244 | + except ApiException as e: |
| 2245 | + pytest.fail(str(e)) |
| 2246 | + |
| 2247 | + @needscredentials |
| 2248 | + def test_update_id_p_setting_example(self): |
| 2249 | + """ |
| 2250 | + update_id_p_setting request example |
| 2251 | + """ |
| 2252 | + try: |
| 2253 | + print('\nupdate_id_p_setting() result:') |
| 2254 | + # begin-update_idp_setting |
| 2255 | + |
| 2256 | + account_idp_settings = iam_identity_service.update_id_p_setting( |
| 2257 | + account_id=account_id, |
| 2258 | + idp_id=idp_id, |
| 2259 | + cloud_user_strategy='STATIC', |
| 2260 | + active=True, |
| 2261 | + ui_default=False, |
| 2262 | + ).get_result() |
| 2263 | + print(json.dumps(account_idp_settings, indent=2)) |
| 2264 | + |
| 2265 | + # end-update_idp_setting |
| 2266 | + |
| 2267 | + except ApiException as e: |
| 2268 | + pytest.fail(str(e)) |
| 2269 | + |
| 2270 | + @needscredentials |
| 2271 | + def test_remove_id_p_setting_example(self): |
| 2272 | + """ |
| 2273 | + remove_id_p_setting request example |
| 2274 | + """ |
| 2275 | + try: |
| 2276 | + # begin-remove_idp_setting |
| 2277 | + |
| 2278 | + response = iam_identity_service.remove_id_p_setting( |
| 2279 | + account_id=account_id, |
| 2280 | + idp_id=idp_id, |
| 2281 | + ) |
| 2282 | + |
| 2283 | + # end-remove_idp_setting |
| 2284 | + |
| 2285 | + print('\nremove_id_p_setting() response status code: ', response.get_status_code()) |
| 2286 | + |
| 2287 | + except ApiException as e: |
| 2288 | + pytest.fail(str(e)) |
| 2289 | + |
| 2290 | + @needscredentials |
| 2291 | + def test_delete_idp_example(self): |
| 2292 | + """ |
| 2293 | + delete_idp request example |
| 2294 | + """ |
| 2295 | + try: |
| 2296 | + # begin-delete_idp |
| 2297 | + |
| 2298 | + response = iam_identity_service.delete_idp(idp_id=idp_id) |
| 2299 | + |
| 2300 | + # end-delete_idp |
| 2301 | + |
| 2302 | + print('\ndelete_idp() response status code: ', response.get_status_code()) |
| 2303 | + |
| 2304 | + except ApiException as e: |
| 2305 | + pytest.fail(str(e)) |
| 2306 | + |
1988 | 2307 | @needscredentials |
1989 | 2308 | def test_update_preference_on_scope_account(self): |
1990 | 2309 | """ |
|
0 commit comments