/// <summary> /// BeginAzureAuthentication method implementation /// </summary> private AuthenticationResponseKind BeginAzureAuthentication(AuthenticationContext ctx) { if (ctx == null) { throw new ArgumentNullException("authContext"); } if (string.IsNullOrEmpty(ctx.UPN)) { throw new InvalidDataException("No user identity was provided."); } BeginTwoWayAuthenticationRequest request = new BeginTwoWayAuthenticationRequest { Lcid = CultureInfo.GetCultureInfo(ctx.Lcid).Name, UserPrincipalName = ctx.UPN, CompanyName = this.CompanyName, AuthenticationMethodId = AuthenticationMethodToString(ctx.SelectedMethod), ReplicationScope = null, ContextId = ctx.ActivityId, }; BeginTwoWayAuthenticationResponse response; try { response = SasProvider.BeginTwoWayAuthentication(request); } catch (Exception ex2) { throw new Exception("Exception calling SAS.", ex2); } if (response.Result.Value != "Success") { return(AuthenticationResponseKind.Error); } ctx.SessionId = response.SessionId; return(ctx.SelectedMethod); }
/// <summary> /// BeginTwoWayAuthentication method implmentation /// </summary> public BeginTwoWayAuthenticationResponse BeginTwoWayAuthentication(BeginTwoWayAuthenticationRequest request) { return(CreateMessage <BeginTwoWayAuthenticationRequest, BeginTwoWayAuthenticationResponse>(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", new object[] { this._serviceUrl, "BeginTwoWayAuthentication" }), request, new Action <HttpWebRequest>(this.SetAuthenticationHeader))); }