Example #1
0
        /*
         * Creates a CNP Online request.
         */
        private cnpOnlineRequest CreateCnpOnlineRequest()
        {
            // Create the request.
            var request = new cnpOnlineRequest();

            request.merchantId  = this.config.GetValue("merchantId");
            request.version     = this.config.GetVersion().ToString();
            request.merchantSdk = CnpVersion.CurrentCNPSDKVersion;

            // Add the schema.
            if (this.config.GetVersion() < new XMLVersion(12, 0))
            {
                request.SetAdditionalAttribute("xmlns", LITLE_NAMESPACE);
            }
            else
            {
                request.SetAdditionalAttribute("xmlns", CNP_NAMESPACE);
            }

            // Create and add the authentication.
            var authentication = new authentication();

            authentication.password = this.config.GetValue("password");
            authentication.user     = this.config.GetValue("username");
            request.authentication  = authentication;

            // Return the request.
            return(request);
        }
Example #2
0
    IEnumerator tryGetPresentation()
    {
        // create authen_payload
        feedback.text = "In leave coroutine";
        authentication payload = new authentication();

        payload.auth_token = login_token.text;
        payload.uuid       = login_id.text;
        string json_payload = JsonUtility.ToJson(payload);

        Debug.Log("STRING == " + json_payload);
        byte[] bytesToEncode = Encoding.UTF8.GetBytes(json_payload);
        string encodedText   = Convert.ToBase64String(bytesToEncode);

        Debug.Log("Encoded AUTH_PAYLOAD = " + encodedText);

        // server address
        string url = "http://192.168.0.9:8080/meetings/" + meetingID.text + "/presentation";

        // sending requests
        UnityWebRequest webRequest = UnityWebRequest.Get(url);

        webRequest.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        webRequest.SetRequestHeader("Content-Type", "application/json");
        webRequest.SetRequestHeader("Authorization", "Bearer " + encodedText);
        yield return(webRequest.SendWebRequest());


        if (webRequest.isNetworkError || webRequest.isHttpError)
        {
            Debug.Log("ERROR: " + webRequest.error);
            // notification_board_failure.SetActive(true);
            feedback.text = "Get presentatino failed :: " + webRequest.responseCode + " :: " + webRequest.error;

            yield break;
        }

        if (webRequest.responseCode == 200)
        {
            // notification_board_success.SetActive(true);
            feedback.text = "Get presentation success";
            Debug.Log("Successfully obtained presentation");
            Texture myTexture = ((DownloadHandlerTexture)webRequest.downloadHandler).texture;
            byte[]  results   = webRequest.downloadHandler.data;

            //Converting byte results of the presentation image into 2D texture
            Texture2D presentationTexture = new Texture2D(2, 2);
            bool      isLoaded            = presentationTexture.LoadImage(results);

            //Apply 2D texture onto raw image -> presentation_image
            if (isLoaded)
            {
                presentation_image         = presentation_image.GetComponent <RawImage>();
                presentation_image.texture = presentationTexture;

                presentation_image.enabled = true;
            }
        }
        yield break;
    }
Example #3
0
        public void insertPnToken(string pnToken)
        {
            var re     = Request;
            var header = re.Headers;

            if (header.Contains("Authorization"))
            {
                string         token = header.GetValues("Authorization").First();
                authentication a     = new authentication();
                a.insertPnToken(pnToken, token);
            }
        }
Example #4
0
        private litleOnlineRequest createLitleOnlineRequest()
        {
            litleOnlineRequest request = new litleOnlineRequest();

            request.merchantId  = config["merchantId"];
            request.merchantSdk = "DotNet;9.12.1";
            authentication authentication = new authentication();

            authentication.password = config["password"];
            authentication.user     = config["username"];
            request.authentication  = authentication;
            return(request);
        }
        private static WWAPI.WWAPI api = new WWAPI.WWAPI(); // initialise API suite
        static void Main(string[] args)
        {
            authentication auth = new authentication(); // fill in authentication details

            auth.username = "******";                   //put your username and password as provided to you previously
            auth.password = "******";

            api.authenticationValue = auth; // add authentication to API suite

            List <WildernessProperty> PropertyList = GetPropertyList();

            List <WildernessAvailability> AvailabilityList = GetAvailabilityByProperty(PropertyList[5], 5, DateTime.Now);
        }
Example #6
0
        private cnpOnlineRequest CreateCnpOnlineRequest()
        {
            var request = new cnpOnlineRequest();

            request.merchantId  = _config["merchantId"];
            request.merchantSdk = "DotNet;12.7.1";
            var authentication = new authentication();

            authentication.password = _config["password"];
            authentication.user     = _config["username"];
            request.authentication  = authentication;
            return(request);
        }
        // GET api/<controller>
        public Customer Get()
        {
            var re     = Request;
            var header = re.Headers;

            if (header.Contains("Authorization"))
            {
                string         token = header.GetValues("Authorization").First();
                authentication a     = new authentication();
                return(a.getUserByToken(token));
            }
            return(null);
        }
Example #8
0
        //
        private void initializeRequest()
        {
            communication = new Communications(config);

            authentication          = new authentication();
            authentication.user     = config["username"];
            authentication.password = config["password"];

            requestDirectory  = Path.Combine(config["requestDirectory"], "Requests") + Path.DirectorySeparatorChar;
            responseDirectory = Path.Combine(config["responseDirectory"], "Responses") + Path.DirectorySeparatorChar;

            cnpXmlSerializer = new cnpXmlSerializer();
            cnpTime          = new cnpTime();
            cnpFile          = new cnpFile();
        }
        private void initializeRequest()
        {
            communication = new Communications();

            authentication          = new authentication();
            authentication.user     = config["username"];
            authentication.password = config["password"];

            requestDirectory  = config["requestDirectory"] + "\\Requests\\";
            responseDirectory = config["responseDirectory"] + "\\Responses\\";

            litleXmlSerializer = new litleXmlSerializer();
            litleTime          = new litleTime();
            litleFile          = new litleFile();
        }
Example #10
0
    IEnumerator tryInitiateMeeting()
    {
        Debug.Log("Trying to initiate meeting...");
        authentication payload = new authentication();

        payload.auth_token = login_token.text;
        payload.uuid       = login_id.text;

        string json_payload = JsonUtility.ToJson(payload);

        Debug.Log("STRING == " + json_payload);
        byte[] bytesToEncode = Encoding.UTF8.GetBytes(json_payload);
        string encodedText   = Convert.ToBase64String(bytesToEncode);

        Debug.Log("Encoded AUTH_PAYLOAD = " + encodedText);
        // server address
        string url = "http://192.168.0.9:8080/meetings";

        UnityWebRequest webRequest = new UnityWebRequest(url, "POST");

        webRequest.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        webRequest.SetRequestHeader("Content-Type", "application/json");
        webRequest.SetRequestHeader("Authorization", "Bearer " + encodedText);

        yield return(webRequest.SendWebRequest());

        if (webRequest.isNetworkError || webRequest.isHttpError)
        {
            Debug.Log("ERROR: " + webRequest.error);
            Debug.Log("Initiate meeting failed");
            feedback.text = "Initiate meeting failed :: " + webRequest.responseCode + " :: " + webRequest.error;
            yield break;
        }

        byte[] buffer = webRequest.downloadHandler.data;
        string json   = System.Text.Encoding.UTF8.GetString(buffer);
        var    result = JsonUtility.FromJson <initiate_success>(json);

        if (webRequest.responseCode == 201)
        {
            feedback.text  = "Initiate meeting successful";
            meetingID.text = result.meeting_id;
            Debug.Log("Initiate meeting SUCCESS!");
        }
        yield break;
    }
Example #11
0
        /*
         * Initializes the request.
         */
        private void InitializeRequest()
        {
            // Create the communications.
            this.communication = new Communications();

            // Create the authentication.
            this.authentication          = new authentication();
            this.authentication.user     = this.config.GetValue("username");
            this.authentication.password = this.config.GetValue("password");

            // Determine the directories.
            requestDirectory  = Path.Combine(this.config.GetValue("requestDirectory"), "Requests") + Path.DirectorySeparatorChar;
            responseDirectory = Path.Combine(this.config.GetValue("responseDirectory"), "Responses") + Path.DirectorySeparatorChar;

            // Create the time and file.
            this.cnpTime = new CNPTime();
            this.cnpFile = new CNPFile();
        }
    /////////////////////////////General////////////////////////////////////////////////////////


    /////////////////////////////Authentication////////////////////////////////////////////////////////

    public int insertUserToken(authentication a)
    {
        SqlConnection con;
        SqlCommand    cmd;

        try
        {
            con = connect("DBConnectionString"); // create the connection
        }
        catch (Exception ex)
        {
            // write to log
            throw (ex);
        }

        String cStr = "UPDATE Customer_igroup4 SET authToken = '" + a.Token + "' where email='" + a.Email + "'"; // helper method to build the insert string

        cmd = CreateCommand(cStr, con);                                                                          // create the command

        try
        {
            int numEffected = cmd.ExecuteNonQuery(); // execute the command
            return(numEffected);
        }
        catch (Exception ex)
        {
            return(0);

            // write to log
            throw (ex);
        }

        finally
        {
            if (con != null)
            {
                // close the db connection
                con.Close();
            }
        }
    }
Example #13
0
    IEnumerator tryLogout()
    {
        feedback.text = "In coroutine";
        authentication payload = new authentication();

        payload.auth_token = login_token.text;
        payload.uuid       = login_id.text;
        string json_payload = JsonUtility.ToJson(payload);

        Debug.Log("STRING == " + json_payload);
        byte[] bytesToEncode = Encoding.UTF8.GetBytes(json_payload);
        string encodedText   = Convert.ToBase64String(bytesToEncode);

        Debug.Log("Encoded AUTH_PAYLOAD = " + encodedText);
        // server address
        string url = "http://192.168.0.9:8080/logout";

        UnityWebRequest webRequest = new UnityWebRequest(url, "POST");

        webRequest.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        webRequest.SetRequestHeader("Content-Type", "application/json");
        webRequest.SetRequestHeader("Authorization", "Bearer " + encodedText);

        yield return(webRequest.SendWebRequest());

        if (webRequest.isNetworkError || webRequest.isHttpError)
        {
            Debug.Log("ERROR: " + webRequest.error);
            feedback.text = "Log out failed :: " + webRequest.responseCode + " :: " + webRequest.error;

            yield break;
        }


        if (webRequest.responseCode == 204)
        {
            feedback.text = "Successfully logged out!";
            Debug.Log("Successfully logged out");
        }
        yield break;
    }
Example #14
0
        private void btnSignout_Click(object sender, EventArgs e)
        {
            authentication authentication = new authentication();

            authentication.signOut();
        }
Example #15
0
 // POST api/<controller>
 public void Post([FromBody] authentication a)
 {
     a.insertUserToken(a);
 }
Example #16
0
        public ServiceManager(
            NodeContainer container, CacheStorage storage, Logger logger, TimerManager timerManager,
            BoundServiceManager boundServiceManager,
            machoNet machoNet,
            objectCaching objectCaching,
            alert alert,
            authentication authentication,
            character character,
            userSvc userSvc,
            charmgr charmgr,
            config config,
            dogmaIM dogmaIM,
            invbroker invbroker,
            warRegistry warRegistry,
            station station,
            map map,
            account account,
            skillMgr skillMgr,
            contractMgr contractMgr,
            corpStationMgr corpStationMgr,
            bookmark bookmark,
            LSC LSC,
            onlineStatus onlineStatus,
            billMgr billMgr,
            facWarMgr facWarMgr,
            corporationSvc corporationSvc,
            clientStatsMgr clientStatsMgr,
            voiceMgr voiceMgr,
            standing2 standing2,
            tutorialSvc tutorialSvc,
            agentMgr agentMgr,
            corpRegistry corpRegistry,
            marketProxy marketProxy,
            stationSvc stationSvc,
            certificateMgr certificateMgr,
            jumpCloneSvc jumpCloneSvc,
            LPSvc LPSvc,
            lookupSvc lookupSvc,
            insuranceSvc insuranceSvc,
            slash slash,
            ship ship,
            corpmgr corpmgr,
            repairSvc repairSvc,
            reprocessingSvc reprocessingSvc,
            ramProxy ramProxy,
            factory factory)
        {
            this.Container           = container;
            this.CacheStorage        = storage;
            this.BoundServiceManager = boundServiceManager;
            this.TimerManager        = timerManager;
            this.Logger = logger;
            this.Log    = this.Logger.CreateLogChannel("ServiceManager");

            // store all the services
            this.machoNet        = machoNet;
            this.objectCaching   = objectCaching;
            this.alert           = alert;
            this.authentication  = authentication;
            this.character       = character;
            this.userSvc         = userSvc;
            this.charmgr         = charmgr;
            this.config          = config;
            this.dogmaIM         = dogmaIM;
            this.invbroker       = invbroker;
            this.warRegistry     = warRegistry;
            this.station         = station;
            this.map             = map;
            this.account         = account;
            this.skillMgr        = skillMgr;
            this.contractMgr     = contractMgr;
            this.corpStationMgr  = corpStationMgr;
            this.bookmark        = bookmark;
            this.LSC             = LSC;
            this.onlineStatus    = onlineStatus;
            this.billMgr         = billMgr;
            this.facWarMgr       = facWarMgr;
            this.corporationSvc  = corporationSvc;
            this.clientStatsMgr  = clientStatsMgr;
            this.voiceMgr        = voiceMgr;
            this.standing2       = standing2;
            this.tutorialSvc     = tutorialSvc;
            this.agentMgr        = agentMgr;
            this.corpRegistry    = corpRegistry;
            this.marketProxy     = marketProxy;
            this.stationSvc      = stationSvc;
            this.certificateMgr  = certificateMgr;
            this.jumpCloneSvc    = jumpCloneSvc;
            this.LPSvc           = LPSvc;
            this.lookupSvc       = lookupSvc;
            this.insuranceSvc    = insuranceSvc;
            this.slash           = slash;
            this.ship            = ship;
            this.corpmgr         = corpmgr;
            this.repairSvc       = repairSvc;
            this.reprocessingSvc = reprocessingSvc;
            this.ramProxy        = ramProxy;
            this.factory         = factory;
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.Label label = new Label();

            // enclosing in try/catch for easier debugging, primarily
            try
            {
                // get a handle to the asset operation service
                proxy = new AssetOperationHandlerService();

                // contruct a path object referencing the 'about' page from the example.com site
                // note:  change this path to a page that actually exists in your cms instance, if necessary
                pagePath = new path();
                // set the relative path (from the Base Folder) to the asset
                pagePath.path1 = "/about";
                // set the site name of the path object (note: set siteName to 'Global' if the asset is not in a Site)
                pagePath.siteName = "example.com";

                // contruct asset identifier used for read() operation
                id = new identifier();
                // set the asset type
                id.type = entityTypeString.page;
                // set asset path (may use either path or id, but never both)
                id.path = pagePath;

                // contruct authentication element to be used in all operations
                auth = new authentication();
                // change username / password as necessary
                auth.username = "******";
                auth.password = "******";

                // attempt to read the asset
                result = proxy.read(auth, id);

                // print asset contents to page label
                label.Text = CascadeWSUtils.printAssetContents(result.asset);

                // edit the asset
                // create an empty asset for use with edit() operation
                // (note: this is assuming the authentication user has bypass workflow abilities --
                // if not, you will also need to supply workflowConfig information)
                asset editAsset = new asset();
                editAsset.page = result.asset.page;
                // add some content to the exiting page xhtml
                editAsset.page.xhtml += "<h1>Added via .NET</h1>";
                // must call this method to avoid sending both id and path values in
                // component references in the asset -- will generate SOAP errors otherwise
                CascadeWSUtils.nullPageValues(editAsset.page);

                // attempt to edit
                operationResult editResult = proxy.edit(auth, editAsset);
                // check results
                label.Text += "<br/><br/>edit success? " + editResult.success + "<br/>message = " + editResult.message;


                // create new asset (using read asset as a model)
                asset newAsset = new asset();
                page  newPage  = result.asset.page;

                // must call this method to avoid sending both id and path values in
                // component references in the asset -- will generate SOAP errors otherwise
                CascadeWSUtils.nullPageValues(newPage);

                // since this will be a new asset, change its name
                newPage.name = "new-page-created-via-dot-net";
                // remove id from read asset
                newPage.id = null;
                // remove other system properties brought over from read asset
                newPage.lastModifiedBy             = null;
                newPage.lastModifiedDate           = null;
                newPage.lastModifiedDateSpecified  = false;
                newPage.lastPublishedBy            = null;
                newPage.lastPublishedDate          = null;
                newPage.lastPublishedDateSpecified = false;
                newPage.pageConfigurations         = null;

                newAsset.page = newPage;

                // attempt to create
                createResult createResults = proxy.create(auth, newAsset);

                // check create results
                label.Text = label.Text + "<br/><br/>create success? " + createResults.success + "<br/>message = " + createResults.message;

                // debugging -- writes the serialzed XML of the asset element sent in create request to a file

                /*
                 * // Serializing the returned object
                 * System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(newAsset.GetType());
                 *
                 * System.IO.MemoryStream ms = new System.IO.MemoryStream();
                 *
                 * x.Serialize(ms, newAsset);
                 *
                 * ms.Position = 0;
                 *
                 * // Outputting to client
                 *
                 * byte[] byteArray = ms.ToArray();
                 *
                 * Response.Clear();
                 * Response.AddHeader("Content-Disposition", "attachment; filename=results.xml");
                 *
                 * Response.AddHeader("Content-Length", byteArray.Length.ToString());
                 *
                 * Response.ContentType = "text/xml";
                 *
                 * Response.BinaryWrite(byteArray);
                 * Response.End();
                 * */
            }
            catch (Exception booboo) { label.Text = "Exception thrown:<br>" + booboo.GetBaseException() + "<br/><br/>STACK TRACE:<br/>" + booboo.StackTrace; }

            WSContent.Controls.Add(label);
        }