public static int DoServiceAuthorizationWithPolicy(string username, string serviceId, string privateKey, bool jailbreakDetection, int?factors, string geofence, string apiURL) { List <Location> locations = null; // parse geofence input if (!string.IsNullOrWhiteSpace(geofence)) { try { var parts = geofence.Split(':'); if (parts.Length != 3) { Console.WriteLine("geofence should be in the format lat:lon:radius:name"); return(1); } var lat = double.Parse(parts[0]); var lon = double.Parse(parts[1]); var rad = double.Parse(parts[2]); var name = parts[3]; locations = new List <Location>(); locations.Add(new Location(rad, lat, lon, name)); } catch (FormatException) { Console.WriteLine("geofence parsing failed"); return(1); } } Console.WriteLine($"Using policy: factors: {factors}, locations: {locations?.Count}, geofence: {geofence}, jailbreak: {jailbreakDetection}"); var policy = new AuthPolicy( jailbreakDetection: jailbreakDetection, locations: locations, requiredFactors: factors ); var serviceClient = ClientFactories.MakeServiceClient(serviceId, privateKey, apiURL); return(SharedServiceHelpers.DoAuthorizationRequest(serviceClient, username, false, policy: policy)); }
public static int DoServiceAuth(string orgId, string privateKey, string serviceId, string userId, string apiURL, bool?useWebhook) { var serviceClient = ClientFactories.MakeOrganizationServiceClient(orgId, privateKey, serviceId, apiURL); return(SharedServiceHelpers.DoAuthorizationRequest(serviceClient, userId, useWebhook)); }
public static int DoServiceAuthorization(string username, string serviceId, string privateKey, string apiURL, string context, int?ttl, string title, string pushTitle, string pushBody, int?fraudDenialreasons, int?nonFraudDenialreasons, bool?useWebhook = false, bool?advancedWebhook = false) { var serviceClient = ClientFactories.MakeServiceClient(serviceId, privateKey, apiURL); return(SharedServiceHelpers.DoAuthorizationRequest(serviceClient, username, useWebhook, advancedWebhook, context, null, title, ttl, pushTitle, pushBody, fraudDenialreasons, nonFraudDenialreasons)); }