Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) OneLogin OIDC - Get Discovery Document (OpenID Connect)Downloads the OpenID Connect self-discovery document for a OneLogin OIDC enabled app. For more information, see https://developers.onelogin.com/openid-connect/connect-to-onelogin
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttp::setCkAccept(http, "application/json") resp.i = CkHttp::ckQuickRequest(http,"GET","https://<account>.onelogin.com/oidc/.well-known/openid-configuration") If CkHttp::ckLastMethodSuccess(http) <> 1 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) ProcedureReturn EndIf Debug "Response Status Code: " + Str(CkHttpResponse::ckStatusCode(resp)) jsonResponse.i = CkJsonObject::ckCreate() If jsonResponse.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoad(jsonResponse,CkHttpResponse::ckBodyStr(resp)) CkJsonObject::setCkEmitCompact(jsonResponse, 0) Debug CkJsonObject::ckEmit(jsonResponse) If CkHttpResponse::ckStatusCode(resp) <> 200 Debug "Failed." CkHttpResponse::ckDispose(resp) CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonResponse) ProcedureReturn EndIf CkHttpResponse::ckDispose(resp) ; Sample output... ; (See the parsing code below..) ; ; Use the this online tool to generate parsing code from sample JSON: ; Generate Parsing Code from JSON ; { ; "acr_values_supported": [ ; "onelogin:nist:level:1:re-auth" ; ], ; "authorization_endpoint": "https://chilkat-dev.onelogin.com/oidc/auth", ; "claims_parameter_supported": true, ; "claims_supported": [ ; "acr", ; "auth_time", ; "company", ; "custom_fields", ; "department", ; "email", ; "family_name", ; "given_name", ; "groups", ; "iss", ; "locale_code", ; "name", ; "params", ; "phone_number", ; "preferred_username", ; "sid", ; "sub", ; "title", ; "updated_at" ; ], ; "grant_types_supported": [ ; "authorization_code", ; "implicit", ; "refresh_token", ; "client_credentials", ; "password" ; ], ; "id_token_signing_alg_values_supported": [ ; "RS256" ; ], ; "issuer": "https://openid-connect.onelogin.com/oidc", ; "jwks_uri": "https://chilkat-dev.onelogin.com/oidc/certs", ; "request_parameter_supported": false, ; "request_uri_parameter_supported": false, ; "response_modes_supported": [ ; "form_post", ; "fragment", ; "query" ; ], ; "response_types_supported": [ ; "code", ; "id_token token", ; "id_token" ; ], ; "scopes_supported": [ ; "openid", ; "name", ; "profile", ; "groups", ; "email", ; "params", ; "phone" ; ], ; "subject_types_supported": [ ; "public" ; ], ; "token_endpoint": "https://chilkat-dev.onelogin.com/oidc/token", ; "token_endpoint_auth_methods_supported": [ ; "client_secret_basic", ; "client_secret_post", ; "none" ; ], ; "userinfo_endpoint": "https://chilkat-dev.onelogin.com/oidc/me", ; "userinfo_signing_alg_values_supported": [ ; ], ; "code_challenge_methods_supported": [ ; "S256" ; ], ; "introspection_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/introspection", ; "introspection_endpoint_auth_methods_supported": [ ; "client_secret_basic", ; "client_secret_post", ; "none" ; ], ; "revocation_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/revocation", ; "revocation_endpoint_auth_methods_supported": [ ; "client_secret_basic", ; "client_secret_post", ; "none" ; ], ; "claim_types_supported": [ ; "normal" ; ] ; } ; authorization_endpoint.s claims_parameter_supported.i issuer.s jwks_uri.s request_parameter_supported.i request_uri_parameter_supported.i token_endpoint.s userinfo_endpoint.s introspection_endpoint.s revocation_endpoint.s i.i count_i.i strVal.s authorization_endpoint = CkJsonObject::ckStringOf(jsonResponse,"authorization_endpoint") claims_parameter_supported = CkJsonObject::ckBoolOf(jsonResponse,"claims_parameter_supported") issuer = CkJsonObject::ckStringOf(jsonResponse,"issuer") jwks_uri = CkJsonObject::ckStringOf(jsonResponse,"jwks_uri") request_parameter_supported = CkJsonObject::ckBoolOf(jsonResponse,"request_parameter_supported") request_uri_parameter_supported = CkJsonObject::ckBoolOf(jsonResponse,"request_uri_parameter_supported") token_endpoint = CkJsonObject::ckStringOf(jsonResponse,"token_endpoint") userinfo_endpoint = CkJsonObject::ckStringOf(jsonResponse,"userinfo_endpoint") introspection_endpoint = CkJsonObject::ckStringOf(jsonResponse,"introspection_endpoint") revocation_endpoint = CkJsonObject::ckStringOf(jsonResponse,"revocation_endpoint") i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"acr_values_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"acr_values_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"claims_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"claims_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"grant_types_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"grant_types_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"id_token_signing_alg_values_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"id_token_signing_alg_values_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"response_modes_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"response_modes_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"response_types_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"response_types_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"scopes_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"scopes_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"subject_types_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"subject_types_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"token_endpoint_auth_methods_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"token_endpoint_auth_methods_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"userinfo_signing_alg_values_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"code_challenge_methods_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"code_challenge_methods_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"introspection_endpoint_auth_methods_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"introspection_endpoint_auth_methods_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"revocation_endpoint_auth_methods_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"revocation_endpoint_auth_methods_supported[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jsonResponse,"claim_types_supported") While i < count_i CkJsonObject::setCkI(jsonResponse, i) strVal = CkJsonObject::ckStringOf(jsonResponse,"claim_types_supported[i]") i = i + 1 Wend CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonResponse) ProcedureReturn EndProcedure |
© 2000-2023 Chilkat Software, Inc. All Rights Reserved.