/// <summary> ///Gets User Info by access token using HTTP /// </summary> /// <param name="oxdWebUrl">Oxd Web REST service URL</param> /// <param name="getUserInfoParams">Input params for Get User Info command via http</param> /// <returns></returns> public GetUserInfoResponse GetUserInfo(string oxdWebUrl, GetUserInfoParams getUserInfoParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(oxdWebUrl)) { throw new ArgumentNullException("Oxd Rest Service URL should not be NULL."); } try { var cmdGetUserInfo = new Command { CommandType = RestCommandType.get_user_info, CommandParams = getUserInfoParams }; var commandClient = new CommandClient(oxdWebUrl); string commandResponse = commandClient.send(cmdGetUserInfo); var response = JsonConvert.DeserializeObject <GetUserInfoResponse>(commandResponse); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting User Info site."); return(null); } }
/// <summary> /// Updates already registered site with input params via http /// </summary> /// <param name="oxdWebUrl">Oxd Web REST service URL</param> /// <param name="registerSiteParams">Input parameters for Register Site via http</param> /// <returns></returns> public UpdateSiteResponse UpdateSiteRegistration(string oxdWebUrl, UpdateSiteParams registerSiteParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(oxdWebUrl)) { throw new ArgumentNullException("Oxd Rest Service URL should not be NULL."); } try { var cmdUpdateSite = new Command { CommandType = RestCommandType.update_site_registration, CommandParams = registerSiteParams }; var commandClient = new CommandClient(oxdWebUrl); string commandResponse = commandClient.send(cmdUpdateSite); var response = JsonConvert.DeserializeObject <UpdateSiteResponse>(commandResponse); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when updating Client Info."); return(null); } }
/// <summary> /// oxd-web Checks Access for UMA RS resource /// </summary> /// <param name="oxdweburl">Oxd Web url</param> /// <param name="umaRsCheckAccessParams">Input params for UMA RS Check Access command</param> /// <returns></returns> public UmaRsCheckAccessResponse CheckAccess(string oxdweburl, UmaRsCheckAccessParams umaRsCheckAccessParams) { Logger.Info("Verifying input parameters."); if (umaRsCheckAccessParams == null) { throw new ArgumentNullException("The UMA RS Check Access command params should not be NULL."); } if (string.IsNullOrEmpty(umaRsCheckAccessParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for checking access of UMA resources."); } if (string.IsNullOrEmpty(umaRsCheckAccessParams.Path)) { throw new MissingFieldException("Valid Path is required for checking access of UMA resource in RS."); } if (string.IsNullOrEmpty(umaRsCheckAccessParams.HttpMethod)) { throw new MissingFieldException("Valid HTTP method is required for checking access of UMA resource in RS."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRsCheckAccess = new Command { CommandType = CommandType.uma_rs_check_access, CommandParams = umaRsCheckAccessParams }; var commandClient = new CommandClient(oxdweburl); string commandResponse = commandClient.send(cmdUmaRsCheckAccess); var response = JsonConvert.DeserializeObject <UmaRsCheckAccessResponse>(commandResponse); if (response.Status.ToLower().Equals("error")) { Logger.Info(string.Format("Got response status as {0}. The error is {1} with description {2}", response.Status, response.Data.Error, response.Data.ErrorDescription)); } else { Logger.Info(string.Format("Got response status as {0} and the access is {1}", response.Status, response.Data.Access)); } return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when checking access of UMA resource."); return(null); } }
private GetRPTResponse GetRPTResponse(UmaRpGetRptParams getRptParams, CommandClient oxdcommand) { var cmdGetRPT = new Command { CommandType = CommandType.uma_rp_get_rpt, CommandParams = getRptParams }; string commandResponse = oxdcommand.send(cmdGetRPT); var response = JsonConvert.DeserializeObject <GetRPTResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and RPT is {1}", response.Status, response.Data.Rpt)); return(response); }
/// <summary> /// oxd-local Get Claims Gathering Url /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="umaRpGetClaimsGatheringUrlParams">Input params for UMA Claims Gathering URL command</param> /// <returns></returns> public UmaRpGetClaimsGatheringUrlResponse GetClaimsGatheringUrl(string host, int port, UmaRpGetClaimsGatheringUrlParams umaRpGetClaimsGatheringUrlParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (umaRpGetClaimsGatheringUrlParams == null) { throw new ArgumentNullException("The UMA RS Check Access command params should not be NULL."); } if (string.IsNullOrEmpty(umaRpGetClaimsGatheringUrlParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for checking access of UMA resources."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRpGetClaimsGatheringUrl = new Command { CommandType = CommandType.uma_rp_get_claims_gathering_url, CommandParams = umaRpGetClaimsGatheringUrlParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdUmaRpGetClaimsGatheringUrl); var response = JsonConvert.DeserializeObject <UmaRpGetClaimsGatheringUrlResponse>(commandResponse); if (response.Status.ToLower().Equals("error")) { Logger.Info(string.Format("Got response status as {0}. The error is {1} with description {2}", response.Status, response.Data.Error, response.Data.ErrorDescription)); } else { Logger.Info(string.Format("Got response status as {0} ", response.Status)); } return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Getting UMA Claims Gathering URL."); return(null); } }
/// <summary> /// Gets different type of tokens by Code using Oxd Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getTokensByCodeParams">Input params for Get Tokens by Code command</param> /// <returns></returns> public GetTokensByCodeResponse GetTokensByCode(string host, int port, GetTokensByCodeParams getTokensByCodeParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getTokensByCodeParams == null) { throw new ArgumentNullException("The get tokens by code command params should not be NULL."); } if (string.IsNullOrEmpty(getTokensByCodeParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting tokens."); } if (string.IsNullOrEmpty(getTokensByCodeParams.Code)) { throw new MissingFieldException("Auth Code is required for getting tokens."); } if (string.IsNullOrEmpty(getTokensByCodeParams.State)) { throw new MissingFieldException("Auth State is required for getting tokens."); } try { Logger.Info("Preparing and sending command."); var cmdGetTokensByCode = new Command { CommandType = CommandType.get_tokens_by_code, CommandParams = getTokensByCodeParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetTokensByCode); var response = JsonConvert.DeserializeObject <GetTokensByCodeResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and access token is {1}", response.Status, response.Data.AccessToken)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting tokens of site."); return(null); } }
/// <summary> /// Gets User Info by access token using Oxd Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getUserInfoParams">Input params for Get User Info command.</param> /// <returns></returns> public GetUserInfoResponse GetUserInfo(string host, int port, GetUserInfoParams getUserInfoParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getUserInfoParams == null) { throw new ArgumentNullException("The get user info command params should not be NULL."); } if (string.IsNullOrEmpty(getUserInfoParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting user info."); } if (string.IsNullOrEmpty(getUserInfoParams.AccessToken)) { throw new MissingFieldException("Access Token is required for getting user info."); } try { Logger.Info("Preparing and sending command."); var cmdGetUserInfo = new Command { CommandType = CommandType.get_user_info, CommandParams = getUserInfoParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetUserInfo); var response = JsonConvert.DeserializeObject <GetUserInfoResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and name is {1}", response.Status, response.Data.UserClaims["name"].FirstOrDefault())); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting user info of site."); return(null); } }
/// <summary> /// oxd-local Protects set of UMA resources in Resource Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="umaRsProtectParams">Input params for UMA RS Protect command</param> /// <returns></returns> public UmaRsProtectResponse ProtectResources(string host, int port, UmaRsProtectParams umaRsProtectParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (umaRsProtectParams == null) { throw new ArgumentNullException("The UMA RS Protect command params should not be NULL."); } if (string.IsNullOrEmpty(umaRsProtectParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for protecting UMA resources."); } if (umaRsProtectParams.ProtectResources == null || umaRsProtectParams.ProtectResources.Count == 0) { throw new MissingFieldException("Valid resources are required for protecting UMA resource in RS."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRsProtect = new Command { CommandType = CommandType.uma_rs_protect, CommandParams = umaRsProtectParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdUmaRsProtect); var response = JsonConvert.DeserializeObject <UmaRsProtectResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0}", response.Status)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when protecting UMA resource."); return(null); } }
/// <summary> /// oxd-local Setup a new Client using the params /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="setupClientParams">Input parameters for Setup Client command</param> /// <returns></returns> public SetupClientResponse SetupClient(String host, int port, SetupClientParams setupClientParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (setupClientParams == null) { throw new ArgumentNullException("The Setup Client command params should not be NULL."); } if (string.IsNullOrEmpty(setupClientParams.AuthorizationRedirectUri)) { throw new MissingFieldException("Authorization Redirect Uri is required."); } try { Logger.Info("Preparing and sending command."); setupClientParams.ProgrammingLanguage = "csharp"; var cmdSetupClient = new Command { CommandType = CommandType.setup_client, CommandParams = setupClientParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdSetupClient); var response = JsonConvert.DeserializeObject <SetupClientResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and Oxd ID is {1}", response.Status, response.Data.OxdId)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Setting up Client."); return(null); } }
/// <summary> /// Updates already registered site with input params. /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="updateSiteParams">Input params for Update Site Registration command</param> /// <returns></returns> public UpdateSiteResponse UpdateSiteRegistration(string host, int port, UpdateSiteParams updateSiteParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (updateSiteParams == null) { throw new ArgumentNullException("The update site command params should not be NULL."); } if (string.IsNullOrEmpty(updateSiteParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for updating site."); } try { Logger.Info("Preparing and sending command."); var cmdUpdateSite = new Command { CommandType = CommandType.update_site_registration, CommandParams = updateSiteParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdUpdateSite); var response = JsonConvert.DeserializeObject <UpdateSiteResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0}", response.Status)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when updating site."); return(null); } }
/// <summary> /// Registers a new site using the params /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="registerSiteParams">Input parameters for Register Site command</param> /// <returns></returns> public RegisterSiteResponse RegisterSite(String host, int port, RegisterSiteParams registerSiteParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (registerSiteParams == null) { throw new ArgumentNullException("The register site command params should not be NULL."); } if (string.IsNullOrEmpty(registerSiteParams.AuthorizationRedirectUri)) { throw new MissingFieldException("Authorization Redirect Uri is required."); } try { Logger.Info("Preparing and sending command."); var cmdRegisterSite = new Command { CommandType = CommandType.register_site, CommandParams = registerSiteParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdRegisterSite); var response = JsonConvert.DeserializeObject <RegisterSiteResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and Oxd ID is {1}", response.Status, response.Data.OxdId)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when registering site."); return(null); } }
/// <summary> /// oxd-local Get Access Token By Refresh Token /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getAccessTokenByRefreshTokenParams">Input params for Get Access Token By Refresh Token command</param> /// <returns></returns> public GetAccessTokenByRefreshTokenResponse GetAccessTokenByRefreshToken(string host, int port, GetAccessTokenByRefreshTokenParams getAccessTokenByRefreshTokenParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getAccessTokenByRefreshTokenParams == null) { throw new ArgumentNullException("The UMA RS Check Access command params should not be NULL."); } if (string.IsNullOrEmpty(getAccessTokenByRefreshTokenParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for checking access of UMA resources."); } try { Logger.Info("Preparing and sending command."); var cmdgetAccessTokenByRefreshToken = new Command { CommandType = CommandType.get_access_token_by_refresh_token, CommandParams = getAccessTokenByRefreshTokenParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdgetAccessTokenByRefreshToken); var response = JsonConvert.DeserializeObject <GetAccessTokenByRefreshTokenResponse>(commandResponse); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Getting UMA Claims Gathering URL."); return(null); } }
/// <summary> /// Gets Authorization URL of a site using input params /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getAuthUrlParams">Input params for Get Authorization URL command</param> /// <returns></returns> public GetAuthorizationUrlResponse GetAuthorizationURL(string host, int port, GetAuthorizationUrlParams getAuthUrlParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getAuthUrlParams == null) { throw new ArgumentNullException("The get auth url command params should not be NULL."); } if (string.IsNullOrEmpty(getAuthUrlParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting auth url of site."); } try { Logger.Info("Preparing and sending command."); var cmdGetAuthUrl = new Command { CommandType = CommandType.get_authorization_url, CommandParams = getAuthUrlParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetAuthUrl); var response = JsonConvert.DeserializeObject <GetAuthorizationUrlResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and auth url is {1}", response.Status, response.Data.AuthorizationUrl)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting auth url of site."); return(null); } }
/// <summary> /// Gets RPT token from UMA RP /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getRptParams">Input params for Get RPT command</param> /// <returns></returns> public GetRPTResponse GetRPT(string host, int port, UmaRpGetRptParams getRptParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getRptParams == null) { throw new ArgumentNullException("The get RPT command params should not be NULL."); } if (string.IsNullOrEmpty(getRptParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting RPT from UMA RP."); } try { Logger.Info("Preparing and sending command."); var cmdGetRPT = new Command { CommandType = CommandType.uma_rp_get_rpt, CommandParams = getRptParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetRPT); var response = JsonConvert.DeserializeObject <GetRPTResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and RPT is {1}", response.Status, response.Data.Rpt)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting RPT token."); return(null); } }
/// <summary> /// oxd-web Get Access Token By Refresh Token /// </summary> /// <param name="oxdweburl">Oxd Web url</param> /// <param name="getAccessTokenByRefreshTokenParams">Input params for Get Access Token By Refresh Token command</param> /// <returns></returns> public GetAccessTokenByRefreshTokenResponse GetAccessTokenByRefreshToken(string oxdweburl, GetAccessTokenByRefreshTokenParams getAccessTokenByRefreshTokenParams) { Logger.Info("Verifying input parameters."); if (getAccessTokenByRefreshTokenParams == null) { throw new ArgumentNullException("The UMA RS Get Claims Gathering Url params should not be NULL."); } if (string.IsNullOrEmpty(getAccessTokenByRefreshTokenParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for Get Claims Gathering Url "); } try { Logger.Info("Preparing and sending command."); var cmdgetAccessTokenByRefreshToken = new Command { CommandType = CommandType.get_access_token_by_refresh_token, CommandParams = getAccessTokenByRefreshTokenParams }; var commandClient = new CommandClient(oxdweburl); string commandResponse = commandClient.send(cmdgetAccessTokenByRefreshToken); var response = JsonConvert.DeserializeObject <GetAccessTokenByRefreshTokenResponse>(commandResponse); if (response.Status.ToLower().Equals("error")) { Logger.Info(string.Format("Got response status as {0} ", response.Status)); } return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Getting UMA Claims Gathering URL."); return(null); } }
/// <summary> /// oxd-web Setup a new Client via http using the params /// </summary> /// <param name="oxdweburl">Oxd to http REST service URL</param> /// <param name="setupClientParams">Input parameters for Setup Client via http</param> /// <returns></returns> public SetupClientResponse SetupClient(string oxdweburl, SetupClientParams setupClientParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(oxdweburl)) { throw new ArgumentNullException("Oxd Rest Service URL should not be NULL."); } try { var cmdSetupClient = new Command { CommandType = RestCommandType.setup_client, CommandParams = setupClientParams }; var commandClient = new CommandClient(oxdweburl); string commandResponse = commandClient.send(cmdSetupClient); var response = JsonConvert.DeserializeObject <SetupClientResponse>(commandResponse); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Setting up Client"); return(null); } }
/// <summary> /// oxd-web Protects set of UMA resources in Resource Server /// </summary> /// <param name="oxdWebUrl">Oxd Web url</param> /// <param name="umaRsProtectParams">Input params for UMA RS Protect command</param> /// <returns></returns> public UmaRsProtectResponse ProtectResources(string oxdWebUrl, UmaRsProtectParams umaRsProtectParams) { if (umaRsProtectParams == null) { throw new ArgumentNullException("oxd-web The UMA RS Protect command params should not be NULL."); } if (string.IsNullOrEmpty(umaRsProtectParams.OxdId)) { throw new MissingFieldException("oxd-web Oxd ID is required for protecting UMA resources."); } if (umaRsProtectParams.ProtectResources == null || umaRsProtectParams.ProtectResources.Count == 0) { throw new MissingFieldException("oxd-web Valid resources are required for protecting UMA resource in RS."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRsProtect = new Command { CommandType = CommandType.uma_rs_protect, CommandParams = umaRsProtectParams }; var commandClient = new CommandClient(oxdWebUrl); string commandResponse = commandClient.send(cmdUmaRsProtect); var response = JsonConvert.DeserializeObject <UmaRsProtectResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0}", response.Status)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when protecting UMA resource (OXD Web)."); return(null); } }
/// <summary> /// Gets Client Access Token /// </summary> /// <param name="oxdtohttpurl">Oxd to http REST service URL</param> /// <param name="getClientTokenParams">Input params to Get Client Acccess Token command</param> /// <returns>Client Token</returns> public GetClientTokenResponse GetClientToken(string oxdtohttpurl, GetClientTokenParams getClientTokenParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(oxdtohttpurl)) { throw new ArgumentNullException("Oxd Rest Service URL should not be NULL."); } try { var cmdGetClientAccessToken = new Command { CommandType = RestCommandType.get_client_token, CommandParams = getClientTokenParams }; var commandClient = new CommandClient(oxdtohttpurl); string commandResponse = commandClient.send(cmdGetClientAccessToken); var response = JsonConvert.DeserializeObject <GetClientTokenResponse>(commandResponse); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting Authorization url"); return(null); } }