public AccountLogic( IAuthenticationData authenticationData, IUnitOfWorkFactory unitOfWorkFactory, IAccountRepository accountRepository ) { _authenticationData = authenticationData; _unitOfWorkFactory = unitOfWorkFactory; _accountRepository = accountRepository; }
public void the_auth_response_is_valid() { string channelName = "my-channel"; string socketId = "123.456"; string expectedAuthString = Config.AppKey + ":" + CreateSignedString(channelName, socketId); IAuthenticationData result = _pusher.Authenticate(channelName, socketId); Assert.AreEqual(expectedAuthString, result.auth); }
public NewsLogic( INewsRepository newsRepository, INewsTextRepository newsTextRepository, IUnitOfWorkFactory unitOfWorkFactory, IAuthenticationData authenticationData) { _newsRepository = newsRepository; _newsTextRepository = newsTextRepository; _unitOfWorkFactory = unitOfWorkFactory; _authenticationData = authenticationData; }
public AuthenticationServiceBase(IConfigSource config) : base(config) { string dllName = String.Empty; string connString = String.Empty; string realm = "auth"; // // Try reading the [AuthenticationService] section first, if it exists // IConfig authConfig = config.Configs["AuthenticationService"]; if (authConfig != null) { dllName = authConfig.GetString("StorageProvider", dllName); connString = authConfig.GetString("ConnectionString", connString); realm = authConfig.GetString("Realm", realm); } // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { if (dllName == String.Empty) { dllName = dbConfig.GetString("StorageProvider", String.Empty); } if (connString == String.Empty) { connString = dbConfig.GetString("ConnectionString", String.Empty); } } // // We tried, but this doesn't exist. We can't proceed. // if (dllName == String.Empty || realm == String.Empty) { throw new Exception("No StorageProvider configured"); } m_Database = LoadPlugin <IAuthenticationData>(dllName, new Object[] { connString, realm }); if (m_Database == null) { throw new Exception(string.Format("Could not find a storage interface in module {0}", dllName)); } }
public string Authorize(string channelName, string socketId) { IAuthenticationData auth = null; if (_presenceData != null) { auth = _pusher.Authenticate(channelName, socketId, _presenceData); } else { auth = _pusher.Authenticate(channelName, socketId); } return(auth.ToJson()); }
public void channel_data_is_encoded_as_JSON() { string channelName = "my-channel"; string socketId = "123.456"; PresenceChannelData data = new PresenceChannelData() { user_id = "unique_user_id", user_info = new { twitter_id = "@leggetter" } }; string expectedChannelData = DefaultSerializer.Default.Serialize(data); IAuthenticationData result = _pusher.Authenticate(channelName, socketId, data); Assert.AreEqual(expectedChannelData, result.channel_data); }
public void the_auth_response_is_valid() { string channelName = "my-channel"; string socketId = "123.456"; PresenceChannelData data = new PresenceChannelData() { user_id = "unique_user_id", user_info = new { twitter_id = "@leggetter" } }; string presenceJson = DefaultSerializer.Default.Serialize(data); string expectedAuthString = Config.AppKey + ":" + CreateSignedString(channelName, socketId, presenceJson); IAuthenticationData result = _pusher.Authenticate(channelName, socketId, data); Assert.AreEqual(expectedAuthString, result.auth); }
public SecurityIdentity Authenticate(IAuthenticationData data) { var nugetApiKeyData = data as NuGetApiKeyAuthenticationData; if (nugetApiKeyData != null) { return(NuGetApiKeyIdentity.Create(nugetApiKeyData.ApiKey, configuration.InstanceSalt)); } var basicData = data as BasicAuthenticationData; if (basicData != null) { return(NuGetApiKeyIdentity.Create(basicData.Password, configuration.InstanceSalt)); } throw new NotSupportedException(); }
RequestItem CreateAuthenticationPassword(IAuthenticationData authdata) { return(new RequestItem { Name = authdata.Name, Request = new Request { Description = authdata.Description, Method = authdata.Method, Url = Convert(new Uri(authdata.Server)), Body = new RawBody { Mode = "raw", Raw = JsonConvert.SerializeObject(authdata, Newtonsoft.Json.Formatting.Indented, JsonSettings.Authentication ) }, Header = new[] { DefaultHeaders.ContentTypeJson } }, Event = new[] { new Event { Listen = "test", Script = new Script { Id = Guid.NewGuid(), Type = "text/javascript", Exec = new[] { "var jsonData = JSON.parse(responseBody);", "postman.setEnvironmentVariable(\"auth_token\", jsonData.access_token);", } } } } }); }
public AlertNotificationService(Uri baseUrl, string apiToken) : base(baseUrl) { _authentication = new BearerAuthentication(apiToken); }
public AuthenticationServiceBase(IConfigSource config) : base(config) { string dllName = String.Empty; string connString = String.Empty; string realm = "auth"; // // Try reading the [AuthenticationService] section first, if it exists // IConfig authConfig = config.Configs["AuthenticationService"]; if (authConfig != null) { dllName = authConfig.GetString("StorageProvider", dllName); connString = authConfig.GetString("ConnectionString", connString); realm = authConfig.GetString("Realm", realm); } // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { if (dllName == String.Empty) dllName = dbConfig.GetString("StorageProvider", String.Empty); if (connString == String.Empty) connString = dbConfig.GetString("ConnectionString", String.Empty); } // // We tried, but this doesn't exist. We can't proceed. // if (dllName == String.Empty || realm == String.Empty) throw new Exception("No StorageProvider configured"); m_Database = LoadPlugin<IAuthenticationData>(dllName, new Object[] {connString, realm}); if (m_Database == null) throw new Exception(string.Format("Could not find a storage interface in module {0}", dllName)); }
public DashboardService(Uri baseUrl, string apiToken) : base(baseUrl) { _authentication = new BearerAuthentication(apiToken); }
public LanguageController(IAuthenticationData authenticationData) : base(authenticationData) { }
public AuthentificationController(IAuthenticationData authenticationData, IAuthentication authentication) : base(authenticationData) { _authentication = authentication; }
public NewsFeedController(INewsLogic newsLogic, IAuthenticationData authenticationData) : base(authenticationData) { _newsLogic = newsLogic; }
protected virtual T ExecutePutRequest <T, TBody>(string relativeUrl, QueryStringParameters parameters = null, TBody body = null, IAuthenticationData authentication = null) where TBody : class { var task = Task.Run(() => ExecutePutRequestAsync <T, TBody>(relativeUrl, parameters, body, authentication)); task.Wait(); return(task.Result); }
protected virtual T ExecuteGetRequest <T>(string relativeUrl, QueryStringParameters parameters = null, IAuthenticationData authentication = null) { var task = Task.Run(() => ExecuteGetRequestAsync <T>(relativeUrl, parameters, authentication)); task.Wait(); return(task.Result); }
public AccountController(IAccountLogic accountLogic, IAuthenticationData authenticationData) : base(authenticationData) { _accountLogic = accountLogic; }
protected BaseController(IAuthenticationData authenticationData) { AuthenticationData = authenticationData; }
protected virtual async Task <T> ExecuteRequestAsync <T, TBody>(HttpMethod httpMethod, string relativeUrl, QueryStringParameters parameters = null, TBody body = null, IAuthenticationData authentication = null) where TBody : class { var uri = CreateActionUri(relativeUrl, parameters); var requestMessage = CreateHttpRequestMessage(httpMethod, uri, authentication); if (body != null) { requestMessage.Content = CreateStringContent(body); } using (var response = await _httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseContentRead)) { var responseStream = await response.Content.ReadAsStreamAsync(); using (var jsonTextReader = new JsonTextReader(new StreamReader(responseStream, Encoding.UTF8))) { var jsonSerializer = CreateJsonSerializer(); if (response.IsSuccessStatusCode) { var result = jsonSerializer.Deserialize <T>(jsonTextReader); return(result); } ExceptionHandler(jsonSerializer, jsonTextReader, uri, response.StatusCode, response.ReasonPhrase); return(default(T)); } } }
public AuthenticationController(IAuthenticationData authenticationData) { _authenticationData = authenticationData; }
protected virtual async Task <T> ExecuteGetRequestAsync <T>(string relativeUrl, QueryStringParameters parameters = null, IAuthenticationData authentication = null) { return(await ExecuteRequestAsync <T, object>(HttpMethod.Get, relativeUrl, parameters, null, authentication)); }
protected virtual HttpRequestMessage CreateHttpRequestMessage(HttpMethod httpMethod, Uri uri, IAuthenticationData authentication = null) { var requestMessage = new HttpRequestMessage(httpMethod, uri); requestMessage.Headers.UserAgent.Clear(); requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaType)); if (authentication != null) { requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authentication.Scheme, authentication.Parameter); } return(requestMessage); }
protected virtual async Task <T> ExecutePostRequestAsync <T, TBody>(string relativeUrl, QueryStringParameters parameters = null, TBody body = null, IAuthenticationData authentication = null) where TBody : class { return(await ExecuteRequestAsync <T, TBody>(HttpMethod.Post, relativeUrl, parameters, body, authentication)); }