private Dictionary <string, ServiceAccessControl10.AccessPointState> AccessPointStateDefaultInitialization() { Dictionary <string, ServiceAccessControl10.AccessPointState> res = new Dictionary <string, ServiceAccessControl10.AccessPointState>(); ServiceAccessControl10.AccessPointState item; item = new ServiceAccessControl10.AccessPointState(); item.Enabled = true; res.Add("tokenAccessPoint1", item); item = new ServiceAccessControl10.AccessPointState(); item.Enabled = true; res.Add("tokenAccessPoint2", item); return(res); }
public override void ExternalAuthorization(string AccessPointToken, string CredentialToken, string Reason, Decision Decision) { Reason = "Other"; AccessPointInfo accessPointInfo = null; try { accessPointInfo = GetInfo(AccessPointToken, C => C.AccessPointInfoList); } catch (SoapException ex) { FaultLib.ReturnFault(string.Format("Access point '{0}' not found. ", AccessPointToken), new[] { "Sender", "InvalidArgVal", "NotFound" }); } AccessPointState accessPointState = GetInfo(AccessPointToken, C => C.AccessPointState); var capabilities = accessPointInfo.Capabilities; Requester requester = Requester.Anonymous; DUT.PACS.Simulator.ServiceCredential10.Credential credentials = new DUT.PACS.Simulator.ServiceCredential10.Credential(); if (!string.IsNullOrEmpty(CredentialToken)) { requester = Requester.Credential; try { credentials = GetInfo(CredentialToken, C => C.CredentialList); } catch (SoapException) { Reason = "Invalid credentials"; EventServer.AccessControlExternalEvent(this, "Access Response", AccessPointToken, CredentialToken, null, Reason, Decision.Denied, requester); throw; } } if (!capabilities.AnonymousAccess && requester == Requester.Anonymous) { Reason = "AnonymousAccess is inaccessible"; EventServer.AccessControlExternalEvent(this, "Access Response", AccessPointToken, CredentialToken, credentials.CredentialHolderReference, Reason, Decision.Denied, requester); FaultLib.ReturnFault(Reason, new string[] { "Sender", "ActionNotSupported", "NotSupported" }); } if (accessPointState.Enabled) { if (capabilities.ExternalAuthorizationSpecified && capabilities.ExternalAuthorization) { EventServer.AccessControlExternalEvent(this, "Access Response", AccessPointToken, CredentialToken, credentials.CredentialHolderReference, Reason, Decision, requester); } else { Reason = "External authorization is inaccessible"; EventServer.AccessControlExternalEvent(this, "Access Response", AccessPointToken, CredentialToken, credentials.CredentialHolderReference, Reason, Decision.Denied, requester); FaultLib.ReturnFault(Reason, new string[] { "Sender", "ActionNotSupported", "NotSupported" }); } } else { Reason = "Access point is disabled"; EventServer.AccessControlExternalEvent(this, "Access Response", AccessPointToken, CredentialToken, credentials.CredentialHolderReference, Reason, Decision.Denied, requester); FaultLib.ReturnFault(Reason, new string[] { "Sender" }); } }