public IOSAccessTokenProvider(GoogleDriveSettings googleDriveSettings)
 {
     settings                     = googleDriveSettings;
     accessTokenRefresher         = new AccessTokenRefresher(settings.UriSchemeClientCredentials);
     accessTokenRefresher.OnDone += HandleAccessTokenRefreshed;
     authCodeExchanger            = new AuthCodeExchanger(settings, settings.UriSchemeClientCredentials);
     authCodeExchanger.OnDone    += HandleAuthCodeExchanged;
 }
 public LoopbackAccessTokenProvider(GoogleDriveSettings googleDriveSettings)
 {
     settings                     = googleDriveSettings;
     unitySyncContext             = SynchronizationContext.Current;
     accessTokenRefresher         = new AccessTokenRefresher(settings.GenericClientCredentials);
     accessTokenRefresher.OnDone += HandleAccessTokenRefreshed;
     authCodeExchanger            = new AuthCodeExchanger(settings, settings.GenericClientCredentials);
     authCodeExchanger.OnDone    += HandleAuthCodeExchanged;
 }
        public LoopbackAccessTokenProvider(GoogleDriveSettings googleDriveSettings)
        {
            settings = googleDriveSettings;

            accessTokenRefresher         = new AccessTokenRefresher(settings);
            accessTokenRefresher.OnDone += HandleAccessTokenRefreshed;

            authCodeExchanger         = new AuthCodeExchanger(settings);
            authCodeExchanger.OnDone += HandleAuthCodeExchanged;
        }
Beispiel #4
0
 public LuminAccessTokenProviderOAuth1(GoogleDriveSettings googleDriveSettings)
 {
     settings    = googleDriveSettings;
     oAuthEvent += OnAuthentication;
     // foreach (var uri in settings.GenericClientCredentials.RedirectUris.Where(uri => uri.Contains("urn")))
     //     redirectUri = uri;
     // if (string.IsNullOrEmpty(redirectUri))
     //     foreach (var uri in settings.GenericClientCredentials.RedirectUris.Where(uri => uri.Contains("localhost")))
     //         redirectUri = uri;
     redirectDispatcher = MLDispatch.OAuthRegisterSchema(redirectUri, ref oAuthEvent);
     cancelDispatcher   = MLDispatch.OAuthRegisterSchema(cancelUri, ref oAuthEvent);
 }
Beispiel #5
0
        public AuthController(GoogleDriveSettings googleDriveSettings)
        {
            settings = googleDriveSettings;

            // WebGL doesn't support loopback method; using redirection scheme instead.
            #if UNITY_WEBGL && !UNITY_EDITOR
            accessTokenProvider = new RedirectAccessTokenProvider(settings);
            #else
            accessTokenProvider = new LoopbackAccessTokenProvider(settings);
            #endif

            accessTokenProvider.OnDone += HandleAccessTokenProviderDone;
        }
        public AuthController(GoogleDriveSettings googleDriveSettings)
        {
            settings = googleDriveSettings;
#if UNITY_WEBGL && !UNITY_EDITOR     // WebGL doesn't support loopback method; using redirection scheme instead.
            accessTokenProvider = new RedirectAccessTokenProvider(settings);
#elif UNITY_ANDROID && !UNITY_EDITOR // On Android a native OpenID lib is used for better UX.
            accessTokenProvider = new AndroidAccessTokenProvider(settings);
#elif UNITY_IOS && !UNITY_EDITOR     // On iOS a native OpenID lib is used for better UX.
            accessTokenProvider = new IOSAccessTokenProvider(settings);
#else // Loopback scheme is used on other platforms.
            accessTokenProvider = new LoopbackAccessTokenProvider(settings);
#endif
            accessTokenProvider.OnDone += HandleAccessTokenProviderDone;
        }
Beispiel #7
0
        public GoogleDriveRequest(string uri, string method)
        {
            Uri    = uri;
            Method = method;

            if (Settings == null)
            {
                Settings = GoogleDriveSettings.LoadFromResources();
            }
            if (AuthController == null)
            {
                AuthController = new AuthController(Settings);
            }
        }
Beispiel #8
0
        public LuminAccessTokenProvider(GoogleDriveSettings googleDriveSettings)
        {
            settings         = googleDriveSettings;
            unitySyncContext = SynchronizationContext.Current;

            accessTokenRefresher         = new AccessTokenRefresher(settings.GenericClientCredentials);
            accessTokenRefresher.OnDone += HandleAccessTokenRefreshed;

            limitedDeviceExchanger         = new LimitedDeviceExchanger(settings, settings.GenericClientCredentials);
            limitedDeviceExchanger.OnDone += HandleLimitedDeviceExchanged;

            deviceCodeExchanger         = new DeviceCodeExchanger(settings, settings.GenericClientCredentials);
            deviceCodeExchanger.OnDone += HandleDeviceCodeExchanged;
        }
Beispiel #9
0
        static AuthController()
        {
            settings = GoogleDriveSettings.LoadFromResources();

            #if UNITY_WEBGL && !UNITY_EDITOR     // WebGL doesn't support loopback method; using redirection scheme instead.
            accessTokenProvider = new RedirectAccessTokenProvider(settings);
            #elif UNITY_LUMIN && !UNITY_EDITOR   // LuminOS based implementation on their own OAuth
            accessTokenProvider = new LuminAccessTokenProvider(settings);
            #elif UNITY_ANDROID && !UNITY_EDITOR // On Android a native OpenID lib is used for better UX.
            accessTokenProvider = new AndroidAccessTokenProvider(settings);
            #elif UNITY_IOS && !UNITY_EDITOR     // On iOS a native OpenID lib is used for better UX.
            accessTokenProvider = new IOSAccessTokenProvider(settings);
            #else // Loopback scheme is used on other platforms.
            accessTokenProvider = new LoopbackAccessTokenProvider(settings);
            #endif
        }
Beispiel #10
0
        private static GoogleDriveSettings GetOrCreateSettings()
        {
            var settings = GoogleDriveSettings.LoadFromResources(true);

            if (!settings)
            {
                settings = CreateInstance <GoogleDriveSettings>();
                Directory.CreateDirectory(Application.dataPath + "/UnityGoogleDrive/Resources");
                const string path = "Assets/UnityGoogleDrive/Resources/GoogleDriveSettings.asset";
                AssetDatabase.CreateAsset(settings, path);
                AssetDatabase.Refresh();
                AssetDatabase.SaveAssets();
                Debug.Log($"UnityGoogleDrive: Settings file didn't exist and was created at: {path}.\n" +
                          "You're free to move it, just make sure it stays in the root of a 'Resources' folder.");
            }
            return(settings);
        }
 public AuthCodeExchanger(GoogleDriveSettings googleDriveSettings, IClientCredentials clientCredentials)
 {
     settings    = googleDriveSettings;
     credentials = clientCredentials;
 }
 public RedirectAccessTokenProvider(GoogleDriveSettings googleDriveSettings)
 {
     settings = googleDriveSettings;
 }
Beispiel #13
0
 public AccessTokenRefresher(GoogleDriveSettings googleDriveSettings)
 {
     settings = googleDriveSettings;
 }
Beispiel #14
0
 public AuthCodeExchanger(GoogleDriveSettings googleDriveSettings)
 {
     settings = googleDriveSettings;
 }
Beispiel #15
0
 public LimitedDeviceExchanger(GoogleDriveSettings googleDriveSettings, IClientCredentials clientCredentials)
 {
     settings    = googleDriveSettings;
     credentials = clientCredentials;
 }