public static string CreateCredentialA11(this ICredentialService s, bool antipassbackViolated = false) { Credential credential = null; CredentialState state = null; return(s.CreateCredentialA11(out credential, out state, antipassbackViolated)); }
private void btnRefresh_Click(object sender, EventArgs e) { try { tvCredentials.Nodes.Clear(); //Credential[] credentials = CredentialClient.GetCredentials(null); List <Credential> credentials = GetList <Credential>(CredentialClient.GetCredentialList); foreach (var credential in credentials) { { TreeNode credentialNode = new TreeNode(credential.token); credentialNode.Tag = credential; CredentialState state = CredentialClient.GetCredentialState(credential.token); credentialNode.Nodes.Add("Enabled", "Enabled: " + (state.Enabled.ToString())); credentialNode.Nodes.Add("Reason", "Reason: " + (state.Reason)); credentialNode.Nodes.Add("AntipassbackState", "AntipassbackState: " + (state.AntipassbackState.AntipassbackViolated.ToString())); tvCredentials.Nodes.Add(credentialNode); } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
/// <summary> /// Creates a new instance of the CredentialResult object with populated properties. /// </summary> /// <param name="state"></param> /// <param name="credentials"></param> /// <returns></returns> public static CredentialResult Create(CredentialState state, ICredentials credentials) { return new CredentialResult { State = state, Credentials = credentials }; }
/// <summary> /// Creates a new instance of the CredentialResult object with populated properties. /// </summary> /// <param name="state"></param> /// <param name="credentials"></param> /// <returns></returns> public static CredentialResult Create(CredentialState state, ICredentials credentials) { return(new CredentialResult { State = state, Credentials = credentials }); }
public static CredentialResult Create(CredentialState state, ICredentials credentials) { CredentialResult result1 = new CredentialResult(); result1.State = state; result1.Credentials = credentials; return(result1); }
private static void GetCredentialStateCallback([MarshalAs(UnmanagedType.SysInt)] CredentialState state) { var args = new CallbackArgs { credentialState = state }; credentialStateCallback(args); credentialStateCallback = null; }
public static CredentialState GetCredentialState(this ICredentialService s, string Token) { s.InitializeGuard(); CredentialState r = null; s.Test.RunStep(() => r = s.ServiceClient.Port.GetCredentialState(Token), "Get CredentialState"); return(r); }
public static string CreateCredentialA11(this ICredentialService s, out string credentialTypeName, bool antipassbackViolated = false) { Credential credential = null; CredentialState state = null; string credentialToken = s.CreateCredentialA11(out credential, out state, antipassbackViolated); credentialTypeName = credential.CredentialIdentifier != null && credential.CredentialIdentifier.Length > 0 ? credential.CredentialIdentifier.First().Type.Name : null; return(credentialToken); }
public async Task <IActionResult> OnGetStatusAsync(string id) { CredentialState state = await _passportService.GetCredentialState(id); if (state == CredentialState.Issued || state == CredentialState.Rejected) { return(new JsonResult(true)); } else { return(new JsonResult(false)); } }
public static string CreateCredentialA11(this ICredentialService s, out Credential credential, out CredentialState state, bool antipassbackViolated = false) { var serviceCapabilities = s.GetServiceCapabilities(); var value = s.GetCredentialIdentifierTypeAndValueA15(serviceCapabilities.SupportedIdentifierType); credential = new Credential { token = "", Description = "Test Description", CredentialHolderReference = "TestUser", CredentialIdentifier = new[] { new CredentialIdentifier { Type = new CredentialIdentifierType { Name = value.TypeName, FormatType = value.FormatType }, Value = value.Value, ExemptedFromAuthentication = false } }, CredentialAccessProfile = null, //new[] { new CredentialAccessProfile { AccessProfileToken = null, ValidFromSpecified = false, ValidToSpecified = false } }, Extension = null, ValidFromSpecified = false, ValidToSpecified = false }; AntipassbackState antipassbackState = null; if (serviceCapabilities.ResetAntipassbackSupported) { antipassbackState = new AntipassbackState() { AntipassbackViolated = antipassbackViolated } } ; state = new CredentialState { Enabled = true, Reason = "Test Reason", AntipassbackState = antipassbackState }; return(s.CreateCredential(credential, state)); }
public void SignalReceived(string deviceToken, string deviceType, string sensor, string value) { ConfStorageLoad(); LoggingService.LogMessage(string.Format("Signal received: token={0}, deviceType={1} sensor={2}, value={3}", deviceToken, deviceType, sensor, value), ExternalLogging.MessageType.Details); if (deviceType == "Door") { DoorState doorState = null; if (ConfStorage.DoorStateList.ContainsKey(deviceToken)) { doorState = ConfStorage.DoorStateList[deviceToken]; } switch (sensor) { case "Alarm": { DoorAlarmState state = (DoorAlarmState)Enum.Parse(typeof(DoorAlarmState), value); if (doorState != null) { doorState.Alarm = state; EventServer.DoorAlarmMonitorEvent(null, "Changed", deviceToken, state); } } break; case "LockPhysicalState": { LockPhysicalState state = (LockPhysicalState)Enum.Parse(typeof(LockPhysicalState), value); if (doorState != null) { doorState.LockPhysicalState = state; EventServer.LockPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "DoubleLockPhysicalState": { LockPhysicalState state = (LockPhysicalState)Enum.Parse(typeof(LockPhysicalState), value); if (doorState != null) { doorState.DoubleLockPhysicalState = state; EventServer.DoubleLockPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "DoorPhysicalState": { DoorPhysicalState state = (DoorPhysicalState)Enum.Parse(typeof(DoorPhysicalState), value); if (doorState != null) { doorState.DoorPhysicalState = state; EventServer.DoorPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "Tamper": { DoorTamperState state = (DoorTamperState)Enum.Parse(typeof(DoorTamperState), value); if ((doorState != null) && (doorState.Tamper != null)) { doorState.Tamper.State = state; EventServer.DoorTamperMonitorEvent(null, "Changed", deviceToken, state); } } break; case "Fault": { DoorFaultState state = (DoorFaultState)Enum.Parse(typeof(DoorFaultState), value); if ((doorState != null) && (doorState.Fault != null)) { doorState.Fault.State = state; EventServer.DoorFaultEvent(null, "Changed", deviceToken, state); } } break; } StateReporter.ReportStateUpdate(deviceToken, doorState); } if (deviceType == "Credential") { CredentialState credentialState = null; if (ConfStorage.CredentialStateList.ContainsKey(deviceToken)) { credentialState = ConfStorage.CredentialStateList[deviceToken]; } switch (sensor) { case "AntipassbackViolated": { bool state = (value == "True"); if (credentialState != null) { credentialState.AntipassbackState.AntipassbackViolated = state; //TODO: event } } break; } } }
public static string CreateCredential(this ICredentialService s, Credential Credential, CredentialState State) { s.InitializeGuard(); string r = null; s.Test.RunStep(() => r = s.ServiceClient.Port.CreateCredential(Credential, State), "Create Credential"); return(r); }
public static string CreateCredentialWithTwoCredentialIdentifierItemsA18(this ICredentialService s, bool antipassbackViolated, CredentialServiceCapabilities serviceCapabilities, out CredentialIdentifier credentialIdentifierFirst, out CredentialIdentifier credentialIdentifierSecond) { credentialIdentifierFirst = null; credentialIdentifierSecond = null; if (serviceCapabilities == null) { serviceCapabilities = s.GetServiceCapabilities(); } var valueFirst = s.GetCredentialIdentifierTypeAndValueA15(serviceCapabilities.SupportedIdentifierType); var valueSecond = s.GetCredentialIdentifierTypeAndValueA15(serviceCapabilities.SupportedIdentifierType.Where(e => e != valueFirst.TypeName)); //7. ONVIF client invokes CreateCredential with parameters by following the procedure mentioned in Annex A.11. var credential = new Credential { token = "", Description = "Test Description", CredentialHolderReference = "TestUser", CredentialIdentifier = new[] { credentialIdentifierFirst = new CredentialIdentifier { Type = new CredentialIdentifierType { Name = valueFirst.TypeName, FormatType = valueFirst.FormatType }, Value = valueFirst.Value, ExemptedFromAuthentication = false }, credentialIdentifierSecond = new CredentialIdentifier { Type = new CredentialIdentifierType { Name = valueSecond.TypeName, FormatType = valueSecond.FormatType }, Value = valueSecond.Value, ExemptedFromAuthentication = false } }, CredentialAccessProfile = null, Extension = null, ValidFromSpecified = false, ValidToSpecified = false }; AntipassbackState antipassbackState = null; if (serviceCapabilities.ResetAntipassbackSupported) { antipassbackState = new AntipassbackState() { AntipassbackViolated = antipassbackViolated } } ; var state = new CredentialState { Enabled = true, Reason = "Test Reason", AntipassbackState = antipassbackState }; return(s.CreateCredential(credential, state)); } }