/// <summary> /// Creates a new TailoredAuthClient class. /// </summary> /// <param name="authClient">The LiveAuthClient instance.</param> public TailoredAuthClient(LiveAuthClient authClient) { Debug.Assert(authClient != null, "authClient cannot be null."); this.authClient = authClient; this.authenticator = new OnlineIdAuthenticator(); }
public async Task <bool> EnsureUserIdentityAsync( CancellationToken cancelToken, string msaAuthPolicy) { OnlineIdServiceTicketRequest[] tickets = new OnlineIdServiceTicketRequest[] { new OnlineIdServiceTicketRequest( LiveIdHostName, msaAuthPolicy) }; try { var onlineIdAuthenticator = new OnlineIdAuthenticator(); m_userIdentity = await onlineIdAuthenticator.AuthenticateUserAsync(tickets, CredentialPromptType.PromptIfNeeded); return(true); } catch (TaskCanceledException) { throw; } catch (Exception) { return(false);; } }
public OnlineIdAuthenticationProvider( string[] scopes, PromptType promptType = PromptType.PromptIfNeeded) : base(null, null, scopes) { this.authenticator = new OnlineIdAuthenticator(); this.credentialPromptType = (CredentialPromptType)promptType; }
public MainPage() { this.InitializeComponent(); Current = this; _authenticator = new OnlineIdAuthenticator(); PromptType = CredentialPromptType.PromptIfNeeded; AccessToken = null; NeedsToGetTicket = true; }
public Scenario01_DelegationToken() { this.InitializeComponent(); _authenticator = new OnlineIdAuthenticator(); PromptType = CredentialPromptType.PromptIfNeeded; SignInOptions.SelectedItem = PromptIfNeeded; AccessToken = null; NeedsToGetTicket = true; SignOutButton.Visibility = CanSignOut ? Visibility.Visible : Visibility.Collapsed; }
public async Task <AuthResult> AuthAsync(string startUrl, string endUrlPrefix) { AuthResult result = new AuthResult(WebAuthenticationStatus.UserCancel); Uri start = null; OnlineIdServiceTicketRequest[] tickets = new OnlineIdServiceTicketRequest[] { new OnlineIdServiceTicketRequest( new Uri(startUrl).Host, String.IsNullOrEmpty(LiveIdAuthPolicy) ? ServiceDefinition.DefaultLiveIdAuthPolicy : LiveIdAuthPolicy) }; try { var onlineIdAuthenticator = new OnlineIdAuthenticator(); UserIdentity useridentity = await onlineIdAuthenticator.AuthenticateUserAsync(tickets, CredentialPromptType.PromptIfNeeded); if (useridentity != null && useridentity.Tickets != null && useridentity.Tickets.Count > 0) { OnlineIdServiceTicket ticket = useridentity.Tickets.First(); start = new Uri(startUrl + WebUtility.UrlEncode("&" + ticket.Value) + "&mobile=true"); } } catch (TaskCanceledException) { result.Status = WebAuthenticationStatus.UserCancel; } catch { start = new Uri(startUrl + "&mobile=true"); } if (start != null) { WebAuthenticationResult webAuthResult = (await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, start, new Uri(endUrlPrefix))); result = new AuthResult(webAuthResult); } return(result); }
public OnlineIdAuthenticationProvider(ServiceInfo serviceInfo) : base(serviceInfo) { this.authenticator = new OnlineIdAuthenticator(); }
public OnlineIdService() { _authenticator = new OnlineIdAuthenticator(); }