/// <summary> /// Logs a user client side into Azure /// </summary> /// <param name="provider">Identity provider to log with (must be of type MicrosoftAccount, Google, Twitter, Facebook or WindowsAzureActiveDirectory)</param> /// <param name="token">Identity provider authentication token</param> /// <returns>An authenticated Azure user</returns> public async Task <MobileServiceUser> LoginAsync(AptkAmaAuthenticationProvider provider, JObject token) { if (provider == AptkAmaAuthenticationProvider.None || provider == AptkAmaAuthenticationProvider.Custom) { throw new ArgumentException("AptkAmaAuthenticationProvider must be of type MicrosoftAccount, Google, Twitter, Facebook or WindowsAzureActiveDirectory"); } var user = await _client.LoginAsync(provider.ToMobileServiceAuthenticationProvider(), token); _configuration.CacheService?.SaveCredentials(new AptkAmaCredentials(provider, user)); return(user); }
public override async Task <MobileServiceUser> LoginAsync(AptkAmaAuthenticationProvider provider, IDictionary <string, string> parameters = null, bool useSingleSignOnIfAvailable = false) { if (provider == AptkAmaAuthenticationProvider.None || provider == AptkAmaAuthenticationProvider.Custom) { throw new ArgumentException("AptkAmaAuthenticationProvider must be of type MicrosoftAccount, Google, Twitter, Facebook or WindowsAzureActiveDirectory"); } var user = await AptkAmaPluginLoader.PlatformIdentityInstance.LoginAsync(provider.ToMobileServiceAuthenticationProvider(), parameters, useSingleSignOnIfAvailable); _configuration.CacheService?.SaveCredentials(new AptkAmaCredentials(provider, user)); return(user); }
public static MobileServiceAuthenticationProvider ToMobileServiceAuthenticationProvider( this AptkAmaAuthenticationProvider authenticationProvider) { switch (authenticationProvider) { default: return(MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory); case AptkAmaAuthenticationProvider.MicrosoftAccount: return(MobileServiceAuthenticationProvider.MicrosoftAccount); case AptkAmaAuthenticationProvider.Google: return(MobileServiceAuthenticationProvider.Google); case AptkAmaAuthenticationProvider.Twitter: return(MobileServiceAuthenticationProvider.Twitter); case AptkAmaAuthenticationProvider.Facebook: return(MobileServiceAuthenticationProvider.Facebook); } }
/// <summary> /// Logs a user server side into Azure /// </summary> /// <param name="provider">Identity provider to log with (must be of type MicrosoftAccount, Google, Twitter, Facebook or WindowsAzureActiveDirectory)</param> /// <param name="parameters">Optional identity provider specific extra parameters</param> /// <param name="useSingleSignOnIfAvailable">Use single sign on if available on platform</param> /// <returns>An authenticated Azure user</returns> public abstract Task <MobileServiceUser> LoginAsync(AptkAmaAuthenticationProvider provider, IDictionary <string, string> parameters = null, bool useSingleSignOnIfAvailable = false);
public AptkAmaCredentials(AptkAmaAuthenticationProvider provider, MobileServiceUser user) { Provider = provider; User = user; }