Beispiel #1
0
        public FileApi(
            ITokenProvider tokenProvider,
            string applicationId,
            string applicationName,
            string storagePath)
        {
            this.authDelegate = new AuthDelegateImpl(tokenProvider);

            var applicationInfo = new ApplicationInfo(
                applicationId,
                applicationName);

            var settings = new FileProfile.Settings(storagePath, false, authDelegate, applicationInfo);

            var lateFileProfile = new LateValue <FileProfile>();

            FileProfile.LoadAsync(settings, lateFileProfile);
            this.profile = lateFileProfile.AwaitValue();


            FileEngine.Settings engineSettings = new FileEngine.Settings("1234", "");

            var lateFileEngine = new LateValue <FileEngine>();

            this.profile.AddEngineAsync(engineSettings, lateFileEngine);
            this.engine = lateFileEngine.AwaitValue();
        }
Beispiel #2
0
    //解除某平台授权
    //platform 平台名 callback 解除完成回调
    public static void DeleteAuthorization(Platform platform, AuthDelegate callback = null)
    {
        if (string.IsNullOrEmpty(appKey))
        {
            Debug.LogError("请设置appkey");
            return;
        }
#if UNITY_ANDROID
        try
        {
            Run(delegate
            {
                var androidAuthListener = new AndroidAuthListener(callback);
                UMSocialSDK.CallStatic("deleteAuthorization", (int)platform, androidAuthListener);
            }
                );
        }
        catch (AndroidJavaException exp)
        {
            Debug.LogError(exp.Message);
        }
#elif UNITY_IPHONE
        authDelegate = callback;
        deleteAuthorization((int)platform, AuthCallback);
#endif
    }
        public Auth0RedirectionMiddleware(RequestDelegate next, Auth0RedirectionMiddlewareOptions options, AuthDelegate authDelegate)
        {
            _next         = next;
            _authDelegate = authDelegate;

            if (options == null)
            {
                throw new Auth0RedirectionMiddlewareException("options parameter should not be null.");
            }

            _options = options;
        }
    //授权某社交平台
    //platform 平台名 callback 授权成功完成
    public static void Authorize(Platform platform, AuthDelegate callback = null)
    {
#if UNITY_ANDROID
        try
        {
            SetPlatforms(new Platform[] { platform });
            Run(delegate
            {
                var androidAuthListener = new AndroidAuthListener(callback);
                UMSocialSDK.CallStatic("authorize", (int)platform, androidAuthListener);
            });
        }
        catch (AndroidJavaException exp)
        {
            Debug.LogError(exp.Message);
        }
#elif UNITY_IPHONE
        authDelegate = callback;
        authorize((int)platform, AuthCallback);
#endif
    }
Beispiel #5
0
 static extern void deleteAuthorization(int platform, AuthDelegate callback);
Beispiel #6
0
 static extern void authorize(int platform, AuthDelegate callback);
Beispiel #7
0
 public AndroidAuthListener(AuthDelegate Delegate)
     : base("com.umeng.socialsdk.UMSocialSDK$AuthListener")
 {
     this.authDelegate = Delegate;
 }
Beispiel #8
0
 public static IApplicationBuilder UseAuth0RedirectionMiddlewareExtensions
     (this IApplicationBuilder builder, Auth0RedirectionMiddlewareOptions options, AuthDelegate authDelegate)
 {
     return(builder.UseMiddleware <Auth0RedirectionMiddleware>(options, authDelegate));
 }
        private bool Login(AuthDelegate callback, string token, Dictionary <string, string> attr, string lang = "", int timeout = 0)
        {
            lock (interLocker)
            {
                if (status == ClientStatus.Connected)
                {
                    ClientEngine.RunTask(() =>
                    {
                        callback(projectId, uid, true, fpnn.ErrorCode.FPNN_EC_OK);
                    });

                    return(true);
                }

                if (status == ClientStatus.Connecting)
                {
                    authStatsInfo.authDelegates.Add(callback);
                    return(true);
                }

                status = ClientStatus.Connecting;
                syncConnectingEvent.Reset();

                requireClose = false;

                if (autoReloginInfo != null)
                {
                    autoReloginInfo.Login();
                }
            }

            authStatsInfo = new AuthStatusInfo
            {
                authDelegates = new HashSet <AuthDelegate>()
                {
                    callback
                },
                remainedTimeout = timeout,
            };

            authStatsInfo.token = token;
            authStatsInfo.attr  = attr;
            authStatsInfo.lang  = lang;
            authStatsInfo.lastActionMsecTimeStamp = ClientEngine.GetCurrentMilliseconds();

            //if (rtmGate.IsConnected())
            //{
            //    if (authStatsInfo.remainedTimeout == 0)
            //        authStatsInfo.remainedTimeout = RTMConfig.globalQuestTimeoutSeconds;

            //    RTMControlCenter.RegisterSession(rtmGateConnectionId, this);
            //    Auth(false);
            //}
            //else
            {
                if (authStatsInfo.remainedTimeout == 0)
                {
                    authStatsInfo.remainedTimeout = ((ConnectTimeout == 0) ? RTMConfig.globalConnectTimeoutSeconds : ConnectTimeout)
                                                    + ((QuestTimeout == 0) ? RTMConfig.globalQuestTimeoutSeconds : QuestTimeout);
                }

                rtmGate.AsyncConnect();
            }

            return(true);
        }
 public bool Login(AuthDelegate callback, string token, Dictionary <string, string> attr, TranslateLanguage language = TranslateLanguage.None, int timeout = 0)
 {
     return(Login(callback, token, attr, GetTranslatedLanguage(language), timeout));
 }
 //-------------[ Login & System interfaces ]--------------------------//
 public bool Login(AuthDelegate callback, string token, int timeout = 0)
 {
     return(Login(callback, token, null, "", timeout));
 }