public ActionResult ActionNotification(int regulatorCode) { //Authenticate var authResult = CERSSecurityManager.AuthenticateHttpAuthorizationHeaderForRegulator(regulatorCode, EDTEndpoint.RegulatorFacilitySubmittalActionNotification, PermissionRole.EDTFacilitySubmittalActionNotification); if (authResult.IsAuthenticatedAndAuthorized) { XElement xmlResult = null; //Begin Transaction using (EDTTransactionScope transScope = new EDTTransactionScope(authResult.Account, EDTEndpoint.RegulatorFacilitySubmittalActionNotification, Request.UserHostAddress, authenticationRequestID: authResult.EDTAuthenticationRequestID)) { try { RegulatorFacilitySubmittalActionNotificationAdapter processor = new RegulatorFacilitySubmittalActionNotificationAdapter(transScope); xmlResult = processor.Process(Request.InputStream, regulatorCode); } catch (Exception ex) { transScope.WriteActivity("Exception Occurred.", ex); transScope.WriteMessage("Exception OCcurred. " + ex.Format(), EDTTransactionMessageType.Error); return(HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Format())); } } return(XmlElement(xmlResult)); } else { return(HttpStatusCodeResult(HttpStatusCode.Unauthorized, authResult)); } }
/// <summary> /// Method processes a instance of CMESubmittal XML passed through the Request.InputStream /// and returns a CMESubmittalResponse. This is the CMESubmittal "Submit" End Point. /// </summary> /// <param name="regulatorCode"></param> /// <returns></returns> public ActionResult Submit(int regulatorCode) { // Authenticate // TODO: For Authenticating CMESubmittal Rights, is having UPAInspector Rights for the specified Regulator Sufficient? var authResult = CERSSecurityManager.AuthenticateHttpAuthorizationHeaderForRegulator(regulatorCode, EDTEndpoint.RegulatorCMESubmit, PermissionRole.EDTCMESubmittalSubmit); if (authResult.IsAuthenticatedAndAuthorized) { XElement xmlResult = null; //Begin Transaction using (EDTTransactionScope transScope = new EDTTransactionScope(authResult.Account, EDTEndpoint.RegulatorCMESubmit, Request.UserHostAddress, authenticationRequestID: authResult.EDTAuthenticationRequestID)) { try { RegulatorCMESubmitAdapter processor = new RegulatorCMESubmitAdapter(transScope); xmlResult = processor.Process(Request.InputStream, null); } catch (Exception ex) { transScope.WriteActivity("Exception Occurred.", ex); transScope.WriteMessage("Exception Occurred. " + ex.Format(), EDTTransactionMessageType.Error); return(HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Format())); } } return(XmlElement(xmlResult)); } else { return(HttpStatusCodeResult(HttpStatusCode.Unauthorized, authResult)); } }
public ActionResult Authenticate(int regulatorCode) { //No role based authentication needed, just make sure they have a valid credential for Library services. var authResult = CERSSecurityManager.AuthenticateHttpAuthorizationHeaderForRegulator(regulatorCode, EDTEndpoint.RegulatorAuthenticationTest, PermissionRole.EDTLibraryServices); if (authResult.Result.Status == AuthenticationStatus.Success) { using (EDTTransactionScope transScope = new EDTTransactionScope(authResult.Account, EDTEndpoint.RegulatorAuthenticationTest, Request.UserHostAddress, authenticationRequestID: authResult.EDTAuthenticationRequestID)) { //return Content("<Result><Status>Succeeded</status><Message>Authentication Succeeded - " + authResult.Account.DisplayName + "</Message></Result>"); return(HttpStatusCodeResult(System.Net.HttpStatusCode.OK, "Authentication Succeeded")); } } else { return(HttpStatusCodeResult(HttpStatusCode.Unauthorized, authResult)); } }
public ActionResult QueryXml(int regulatorCode) { //Authenticate var authResult = CERSSecurityManager.AuthenticateHttpAuthorizationHeaderForRegulator(regulatorCode, EDTEndpoint.RegulatorFacilitySubmittalQuery, PermissionRole.EDTFacilitySubmittalQuery); if (authResult.IsAuthenticatedAndAuthorized) { XElement xmlResult = null; //Begin Transaction using (EDTTransactionScope transScope = new EDTTransactionScope(authResult.Account, EDTEndpoint.RegulatorFacilitySubmittalQuery, Request.UserHostAddress, authenticationRequestID: authResult.EDTAuthenticationRequestID)) { try { //build of the argument bag. var args = new RegulatorFacilitySubmittalQueryArguments(Request.QueryString); args.RegulatorCode = regulatorCode; //intialize the processor to handle this EDT transaction for this Data Flow. var processor = new RegulatorFacilitySubmittalQueryAdapter(transScope); //get the XML back. xmlResult = processor.Process(args); //write log transScope.WriteActivity("Successfully Generated XML Package"); } catch (Exception ex) { transScope.WriteActivity("Exception Occurred.", ex); transScope.WriteMessage("Exception OCcurred. " + ex.Format(), EDTTransactionMessageType.Error); return(HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Format())); } } return(XmlElement(xmlResult)); } else { return(HttpStatusCodeResult(HttpStatusCode.Unauthorized, authResult)); } }
public ActionResult FacilityTransferQuery(int regulatorCode) { //Authenticate var authResult = CERSSecurityManager.AuthenticateHttpAuthorizationHeaderForRegulator(regulatorCode, EDTEndpoint.RegulatorFacilityTransferQuery, PermissionRole.EDTFacilityTransferQuery); if (authResult.IsAuthenticatedAndAuthorized) { XElement xmlResult = null; //Begin Transaction using (EDTTransactionScope transScope = new EDTTransactionScope(authResult.Account, EDTEndpoint.RegulatorFacilityTransferQuery, Request.UserHostAddress, authenticationRequestID: authResult.EDTAuthenticationRequestID)) { try { //build of the argument bag. var args = new RegulatorFacilityTransferQueryArguments(Request.QueryString); args.RegulatorCode = regulatorCode; RegulatorFacilityTransferQueryAdapter adapter = new RegulatorFacilityTransferQueryAdapter(transScope); xmlResult = adapter.Process(args); } catch (Exception ex) { transScope.WriteMessage("Exception Occurred. " + ex.Format(), EDTTransactionMessageType.Error); transScope.Complete(EDTTransactionStatus.ErrorProcessing); return(HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Format())); } } return(XmlElement(xmlResult)); } else { return(HttpStatusCodeResult(HttpStatusCode.Unauthorized, authResult)); } }