public HttpResponseMessage GetAllMessageTypes() { var js = "var ms=[];"; StringBuilder sb = new StringBuilder(); sb.AppendLine(js); Michal.Balador.Contracts.Mechanism.AuthenticationManager authenticationManager = null; MockRepository mockData = new MockRepository(); foreach (var senderRule in _senderRules) { authenticationManager = null; using (var factory = senderRule.Value) { authenticationManager = factory.GetAuthenticationManager(); if (authenticationManager != null) { var configuration = authenticationManager.ServiceName; var djs = $"ms.push('{authenticationManager.ServiceName}');"; sb.AppendLine(djs); } } } //// Return the echo response var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(sb.ToString(), Encoding.UTF8, "application/javascript") }; return(response); }
public async Task <HttpResponseMessage> GetMessagers() { List <FormSignThirdPartyToken> authentications = new List <FormSignThirdPartyToken>(); try { SignUpSender signUpSender = await GetUserid(); Michal.Balador.Contracts.Mechanism.AuthenticationManager authenticationManager = null; MockRepository mockData = new MockRepository(); foreach (var senderRule in _senderRules) { authenticationManager = null; var factory = senderRule.Value; authenticationManager = factory.GetAuthenticationManager(); if (authenticationManager != null) { var configuration = await authenticationManager.Register(signUpSender); authentications.Add(new FormSignThirdPartyToken { Id = configuration.Id.ToString(), Fields = configuration.ExtraFields, Message = configuration.TextLandPageTemplate, Name = authenticationManager.AuthenticationName, Title = authenticationManager.AuthenticationTitle, IsAlreadyRegister = configuration.IsAlreadyRegister, TwoFactorAuthentication = configuration.TwoFactorAuthentication, Agreement = configuration.Agreement, HelpFile = configuration.HelpFile, IsAgreement = configuration.IsAgreement, Logo = configuration.Logo }); } } var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <FormSignThirdPartyToken[]>(authentications.ToArray(), new JsonMediaTypeFormatter(), new MediaTypeWithQualityHeaderValue("application/json")) }; return(response); } catch (Exception ee) { Console.WriteLine(ee); var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new ObjectContent <FormSignThirdPartyToken[]>(authentications.ToArray(), new JsonMediaTypeFormatter(), new MediaTypeWithQualityHeaderValue("application/json")) }; return(response); } }