Esempio n. 1
0
        /*
         *              authorized http request & response handlers.
         */

        /**
         *              fire when generating http request, via Autoya.Http_X.
         *              you can add some kind of authorization parameter to request header.
         */
        private Dictionary <string, string> OnHttpRequest(string method, string url, Dictionary <string, string> requestHeader, string data)
        {
            var accessToken = Autoya.Persist_Load(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN, AuthSettings.AUTH_STORED_TOKEN_FILENAME);

            requestHeader["Authorization"] = Base64.FromString(accessToken);

            return(requestHeader);
        }
Esempio n. 2
0
        /*
         *  AssetBundles handlers.
         */

        // assetBundleList store controls.
        private AssetBundleList[] LoadAssetBundleListsFromStorage()
        {
            // load stored assetBundleList then return it.
            var filePaths = Autoya.Persist_FileNamesInDomain(AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN);

            return(filePaths.Select(
                       path => JsonUtility.FromJson <AssetBundleList>(
                           Autoya.Persist_Load(
                               AssetBundlesSettings.ASSETBUNDLES_LIST_STORED_DOMAIN, Path.GetFileName(path)
                               )
                           )
                       ).ToArray());
        }
Esempio n. 3
0
        /**
         *              received Unauthorized code from server. then, should authenticate again.
         *              set header and data for refresh token.
         */
        private IEnumerator OnTokenRefreshRequest(Action <Dictionary <string, string>, string> setHeaderToRequest)
        {
            // set refresh body data for Http.Post to server.(if empty, this framework use Http.Get for sending data to server.)
            var data = "some refresh data";

            // return refresh token for re-authenticate.
            var refreshToken = Autoya.Persist_Load(AuthSettings.AUTH_STORED_FRAMEWORK_DOMAIN, AuthSettings.AUTH_STORED_TOKEN_FILENAME);

            var base64Str = Base64.FromString(refreshToken);

            var refreshRequestHeader = new Dictionary <string, string> {
                { "Authorization", base64Str }
            };

            setHeaderToRequest(refreshRequestHeader, data);
            yield break;
        }