public override List <Contact> GetContacts() { Token token = ConnectionToken; List <Contact> contacts = new List <Contact>(); string response = ""; try { logger.Debug("Executing contacts feed"); Stream responseStream = AuthenticationStrategy.ExecuteFeed(ContactsEndpoint, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JArray contactsJson = JArray.Parse(JObject.Parse(response).SelectToken("entry").ToString()); if (contactsJson.Count > 0) { contactsJson.ToList().ForEach(person => contacts.Add(new Contact() { ID = person.SelectToken("person.id") != null ? person.SelectToken("person.id").ToString().Replace("\"", "") : "", ProfileURL = person.SelectToken("person.profileUrl").ToString().Replace("\"", ""), Name = person.SelectToken("person.name.givenName") != null ? person.SelectToken("person.name.givenName").ToString() : "" + " " + person.SelectToken("person.name.familyName") != null ? person.SelectToken("person.name.familyName").ToString().Replace("\"", "") : "" })); } logger.Info("Contacts successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ContactsParsingError(response), ex); throw new DataParsingException(ErrorMessages.ContactsParsingError(response), ex); } return(contacts.ToList()); }
public override List <Contact> GetContacts() { Token token = ConnectionToken; List <Contact> contacts = new List <Contact>(); string response = ""; try { logger.Debug("Executing contacts feed"); Stream responseStream = AuthenticationStrategy.ExecuteFeed(ContactsEndpoint + "?access_token=" + token.AccessToken, null, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JObject contactsJson = JObject.Parse(response); contactsJson.SelectToken("data").ToList().ForEach(x => { contacts.Add(new Contact() { ID = x.SelectToken("id").ToString(), Name = getName(x) }); } ); logger.Info("Contacts successfully received"); return(contacts); } catch (Exception ex) { logger.Error(ErrorMessages.ContactsParsingError(response), ex); throw new DataParsingException(ErrorMessages.ContactsParsingError(response), ex); } }
private List <Contact> Friends(string friendUserIDs, Token token) { string lookupUrl = "http://api.twitter.com/1/users/lookup.json?user_id=" + friendUserIDs; OAuthHelper helper = new OAuthHelper(); string friendsData = ""; try { Stream responseStream = AuthenticationStrategy.ExecuteFeed(lookupUrl, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); friendsData = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } List <Contact> friends = new List <Contact>(); try { JArray j = JArray.Parse(friendsData); j.ToList().ForEach(f => friends.Add( new Contact() { Name = (string)f["name"], ID = (string)f["id_str"], ProfileURL = "http://twitter.com/#!/" + (string)f["screen_name"] })); } catch { throw; } return(friends.ToList <Contact>()); }
public BasicAuthManager(UserRepository userRepository, PasswordPolicy passwordPolicy, AuthenticationStrategy authStrategy, UserRepository initialUserRepository) { this.UserRepository = userRepository; this.PasswordPolicy = passwordPolicy; this.AuthStrategy = authStrategy; this._initialUserRepository = initialUserRepository; }
//****** OPERATIONS public override UserProfile GetProfile() { Token token = ConnectionToken; UserProfile profile = new UserProfile(ProviderType); string response = ""; //If token already has profile for this provider, we can return it to avoid a call if (token.Profile.IsSet || !IsProfileSupported) { return(token.Profile); } var provider = ProviderFactory.GetProvider(token.Provider); if (GetScope().ToLower().Contains("https://www.googleapis.com/auth/userinfo.profile")) { try { logger.Debug("Executing profile feed"); Stream responseStream = AuthenticationStrategy.ExecuteFeed(ProfileEndpoint, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JObject profileJson = JObject.Parse(response); //{"entry":{"profileUrl":"https://plus.google.com/103908432244378021535","isViewer":true,"id":"103908432244378021535", // "name":{"formatted":"deepak Aggarwal","familyName":"Aggarwal","givenName":"deepak"}, // "thumbnailUrl":"http://www.,"urls":[{"value":"https://plus.google.com/103908432244378021535","type":"profile"}], // "photos":[{"value":"http://www.google.com/ig/c/photos/public/AIbEiAIAAABDCJ_d1payzeKeNiILdmNhcmRfcGhvdG8qKGFjM2RmMzQ1ZDc4Nzg5NmI5NmFjYTc1NDNjOTA3MmQ5MmNmOTYzZWIwAe0HZMa7crOI_laYBG7LxYvlAvqe","type":"thumbnail"}],"displayName":"deepak Aggarwal"}} profile.Provider = ProviderType; profile.ID = profileJson.Get("id"); profile.ProfileURL = profileJson.Get("link"); profile.FirstName = profileJson.Get("given_name"); profile.LastName = profileJson.Get("family_name"); profile.ProfilePictureURL = profileJson.Get("picture"); profile.GenderType = Utility.ParseGender(profileJson.Get("gender")); } catch (Exception ex) { logger.Error(ErrorMessages.ProfileParsingError(response), ex); throw new DataParsingException(response, ex); } } else { profile.FirstName = token.ResponseCollection["openid.ext1.value.firstname"]; profile.LastName = token.ResponseCollection["openid.ext1.value.lastname"]; } profile.Email = token.ResponseCollection.Get("openid.ext1.value.email"); profile.Country = token.ResponseCollection.Get("openid.ext1.value.country"); profile.Language = token.ResponseCollection.Get("openid.ext1.value.language"); profile.IsSet = true; token.Profile = profile; logger.Info("Profile successfully received"); return(profile); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void assertSetUsersAndRolesNTimes(boolean usersChanged, boolean rolesChanged, int nSetUsers, int nSetRoles) throws Throwable private void AssertSetUsersAndRolesNTimes(bool usersChanged, bool rolesChanged, int nSetUsers, int nSetRoles) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.server.security.auth.UserRepository userRepository = mock(org.neo4j.server.security.auth.UserRepository.class); UserRepository userRepository = mock(typeof(UserRepository)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RoleRepository roleRepository = mock(RoleRepository.class); RoleRepository roleRepository = mock(typeof(RoleRepository)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.server.security.auth.UserRepository initialUserRepository = mock(org.neo4j.server.security.auth.UserRepository.class); UserRepository initialUserRepository = mock(typeof(UserRepository)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.server.security.auth.UserRepository defaultAdminRepository = mock(org.neo4j.server.security.auth.UserRepository.class); UserRepository defaultAdminRepository = mock(typeof(UserRepository)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.api.security.PasswordPolicy passwordPolicy = new org.neo4j.server.security.auth.BasicPasswordPolicy(); PasswordPolicy passwordPolicy = new BasicPasswordPolicy(); AuthenticationStrategy authenticationStrategy = NewRateLimitedAuthStrategy(); InternalFlatFileRealmIT.TestJobScheduler jobScheduler = new InternalFlatFileRealmIT.TestJobScheduler(); InternalFlatFileRealm realm = new InternalFlatFileRealm(userRepository, roleRepository, passwordPolicy, authenticationStrategy, jobScheduler, initialUserRepository, defaultAdminRepository); when(userRepository.PersistedSnapshot).thenReturn(new ListSnapshot <>(10L, Collections.emptyList(), usersChanged)); when(userRepository.GetUserByName(any())).thenReturn((new User.Builder()).build()); when(roleRepository.PersistedSnapshot).thenReturn(new ListSnapshot <>(10L, Collections.emptyList(), rolesChanged)); when(roleRepository.GetRoleByName(anyString())).thenReturn(new RoleRecord("")); realm.init(); realm.Start(); jobScheduler.ScheduledRunnable.run(); verify(userRepository, times(nSetUsers)).Users = any(); verify(roleRepository, times(nSetRoles)).Roles = any(); }
public RuntimeAuthenticationTypeViewModel() { this.runtimeAuthStrategy = AuthenticationStrategy.WebServerFlow; this.Title = Resources.RuntimeAuthenticationTypeViewModel_Title; this.Description = Resources.RuntimeAuthenticationTypeViewModel_Description; this.Legend = Resources.RuntimeAuthenticationTypeViewModel_Legend; this.View = new RuntimeAuthenticationTypePage(this); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnFailureForInvalidAttempt() public virtual void ShouldReturnFailureForInvalidAttempt() { // Given FakeClock clock = FakeClock; AuthenticationStrategy authStrategy = NewAuthStrategy(clock, 3); User user = (new User.Builder("user", LegacyCredential.ForPassword("right"))).build(); // Then assertThat(authStrategy.Authenticate(user, password("wrong")), equalTo(AuthenticationResult.FAILURE)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { Config = Config.defaults(); Users = CommunitySecurityModule.getUserRepository(Config, NullLogProvider.Instance, FsRule.get()); _authStrategy = mock(typeof(AuthenticationStrategy)); _logProvider = new AssertableLogProvider(); _manager = CreateAuthManager(true); _userManager = _manager.UserManager; }
public virtual WebResponse ExecuteFeed(string feedURL, TRANSPORT_METHOD transportMethod, byte[] content = null, Dictionary <string, string> headers = null) { if (AuthenticationStrategy != null) { return(AuthenticationStrategy.ExecuteFeed(feedURL, (IProvider)this, GetConnectionToken(), transportMethod, content, headers)); } else { throw new NotImplementedException("This method is not implemented!;"); } }
public AuthenticationController(UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager, ICryptography cryptography, IConfiguration configuration, ILogger <AuthenticationController> logger, ICodesServices codesServices) { this.userManager = userManager; this.logger = logger; authenticationStrategy = new AuthenticationStrategy(userManager, signInManager, cryptography, configuration, logger, codesServices); }
private void TestUnlimitedFailedAuthAttempts(int maxFailedAttempts) { FakeClock clock = FakeClock; AuthenticationStrategy authStrategy = NewAuthStrategy(clock, maxFailedAttempts); User user = (new User.Builder("user", LegacyCredential.ForPassword("right"))).build(); int attempts = ThreadLocalRandom.current().Next(5, 100); for (int i = 0; i < attempts; i++) { assertEquals(AuthenticationResult.FAILURE, authStrategy.Authenticate(user, password("wrong"))); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void setupAuthManager(org.neo4j.server.security.auth.AuthenticationStrategy authStrategy) throws Throwable private void SetupAuthManager(AuthenticationStrategy authStrategy) { FormattedLog.Builder builder = FormattedLog.withUTCTimeZone(); _securityLogWriter = new StringWriter(); Log log = builder.ToWriter(_securityLogWriter); _securityLog = new SecurityLog(log); InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(_users, new InMemoryRoleRepository(), new BasicPasswordPolicy(), authStrategy, mock(typeof(JobScheduler)), new InMemoryUserRepository(), new InMemoryUserRepository() ); _manager = new MultiRealmAuthManager(internalFlatFileRealm, Collections.singleton(internalFlatFileRealm), new MemoryConstrainedCacheManager(), _securityLog, true, false, Collections.emptyMap()); _manager.init(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotSlowRequestRateOnLessThanMaxFailedAttempts() public virtual void ShouldNotSlowRequestRateOnLessThanMaxFailedAttempts() { // Given FakeClock clock = FakeClock; AuthenticationStrategy authStrategy = NewAuthStrategy(clock, 3); User user = (new User.Builder("user", LegacyCredential.ForPassword("right"))).build(); // When we've failed two times assertThat(authStrategy.Authenticate(user, password("wrong")), equalTo(AuthenticationResult.FAILURE)); assertThat(authStrategy.Authenticate(user, password("wrong")), equalTo(AuthenticationResult.FAILURE)); // Then assertThat(authStrategy.Authenticate(user, password("right")), equalTo(AuthenticationResult.SUCCESS)); }
public async Task <string> TestConnection() { try { AuthenticationStrategy authenticationStrategy = null; if (credentialLogin) { authenticationStrategy = new LwssoAuthenticationStrategy(new UserPassConnectionInfo(OctaneConfiguration.Username, OctaneConfiguration.Password)); } else if (ssologin) { authenticationStrategy = new SsoAuthenticationStrategy(); } await authenticationStrategy.TestConnection(url); // Don't do advanced test connection with sso login, will cause deadlock if (credentialLogin) { // reset and thus require a new octane service obj Run(async() => { return(await OctaneServices.Reset()); }).Wait(); // hotfix for first time installing the plugin and clicking test connection if (OctaneConfiguration.CredentialLogin == false) { OctaneConfiguration.CredentialLogin = true; } // create a new service object OctaneServices.Create(OctaneConfiguration.Url, OctaneConfiguration.SharedSpaceId, OctaneConfiguration.WorkSpaceId); await OctaneServices.GetInstance().Connect(); // try to get the work item root await OctaneServices.GetInstance().GetAsyncWorkItemRoot(); } return(ConnectionSuccessful); } catch (Exception ex) { return(ex.Message); } }
//****** OPERATIONS public override UserProfile GetProfile() { Token token = SocialAuthUser.GetCurrentUser().GetConnection(this.ProviderType).GetConnectionToken(); UserProfile profile = new UserProfile(ProviderType); string response = ""; //If token already has profile for this provider, we can return it to avoid a call if (token.Profile.IsSet) { logger.Debug("Profile successfully returned from session"); return(token.Profile); } try { logger.Debug("Executing Profile feed"); string profileUrl = ProfileEndpoint + "?user_id=" + token.Profile.ID; Stream responseStream = AuthenticationStrategy.ExecuteFeed(profileUrl, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JObject profileJson = JObject.Parse(response); profile.ID = profileJson.Get("id_str"); profile.FirstName = profileJson.Get("name"); profile.Country = profileJson.Get("location"); profile.DisplayName = profileJson.Get("screen_name"); //profile.Email = not provided profile.Language = profileJson.Get("lang"); profile.ProfilePictureURL = profileJson.Get("profile_image_url"); profile.IsSet = true; token.Profile = profile; logger.Info("Profile successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ProfileParsingError(response), ex); throw new DataParsingException(ErrorMessages.ProfileParsingError(response), ex); } return(profile); }
public async Task <bool> ConnectAsync(string host, AuthenticationStrategy authenticationStrategy) { if (host == null) { throw new ArgumentNullException("host"); } if (authenticationStrategy == null) { throw new ArgumentNullException("authenticationStrategy"); } this.authenticationStrategy = authenticationStrategy; this.Host = host.TrimEnd('/'); return(await authenticationStrategy.ConnectAsync(this.Host).ConfigureAwait(AwaitContinueOnCapturedContext)); }
internal InternalFlatFileRealm( UserRepository userRepository, RoleRepository roleRepository, PasswordPolicy passwordPolicy, AuthenticationStrategy authenticationStrategy, bool authenticationEnabled, bool authorizationEnabled, JobScheduler jobScheduler, UserRepository initialUserRepository, UserRepository defaultAdminRepository ) : base() { Name = SecuritySettings.NATIVE_REALM_NAME; this._userRepository = userRepository; this._roleRepository = roleRepository; this._initialUserRepository = initialUserRepository; this._defaultAdminRepository = defaultAdminRepository; this._passwordPolicy = passwordPolicy; this._authenticationStrategy = authenticationStrategy; this._authenticationEnabled = authenticationEnabled; this._authorizationEnabled = authorizationEnabled; this._jobScheduler = jobScheduler; AuthenticationCachingEnabled = false; // NOTE: If this is ever changed to true it is not secure to use // AllowAllCredentialsMatcher anymore AuthorizationCachingEnabled = false; CredentialsMatcher = new AllowAllCredentialsMatcher(); // Since we do not cache authentication info we can // disable the credentials matcher RolePermissionResolver = PredefinedRolesBuilder.RolePermissionResolver; }
public override List <Contact> GetContacts() { Token token = ConnectionToken; //If only OpenID is used and also there is no scope for contacts, return blank list straight away if (string.IsNullOrEmpty(token.AccessToken) || !(GetScope().ToLower().Contains("/m8/feeds"))) { return(new List <Contact>()); } IEnumerable <Contact> contacts; string response = ""; try { logger.Debug("Executing contacts feed"); Stream responseStream = AuthenticationStrategy.ExecuteFeed(ContactsEndpoint, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { XDocument contactsXML = XDocument.Parse(response); XNamespace xn = "http://schemas.google.com/g/2005"; contacts = from c in contactsXML.Descendants(contactsXML.Root.GetDefaultNamespace() + "entry") select new Contact() { ID = c.Element(contactsXML.Root.GetDefaultNamespace() + "id").Value, Name = c.Element(contactsXML.Root.GetDefaultNamespace() + "title").Value, Email = (c.Element(xn + "email") == null) ? "" : c.Element(xn + "email").Attribute("address").Value, ProfilePictureURL = "" }; logger.Info("Contacts successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ContactsParsingError(response), ex); throw new DataParsingException(ErrorMessages.ContactsParsingError(response), ex); } return(contacts.ToList()); }
//****** OPERATIONS public override UserProfile GetProfile() { Token token = ConnectionToken; string response = ""; //If token already has profile for this provider, we can return it to avoid a call if (token.Profile.IsSet) { return(token.Profile); } try { logger.Debug("Executing Profile feed"); Stream responseStream = AuthenticationStrategy.ExecuteFeed(ProfileEndpoint, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JObject profileJson = JObject.Parse(response); token.Profile.ID = profileJson.Get("person.id"); token.Profile.FirstName = profileJson.Get("person.name.givenName"); token.Profile.LastName = profileJson.Get("person.name.familyName"); token.Profile.Country = profileJson.Get("person.location"); token.Profile.Language = profileJson.Get("person.lang"); token.Profile.ProfilePictureURL = profileJson.Get("person.thumbnailUrl"); token.Profile.IsSet = true; logger.Info("Profile successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ProfileParsingError(response), ex); throw new DataParsingException(ErrorMessages.ProfileParsingError(response), ex); } return(token.Profile); }
public virtual bool IsAuthenticationRequested(HttpHost host, HttpResponse response , AuthenticationStrategy authStrategy, AuthState authState, HttpContext context) { if (authStrategy.IsAuthenticationRequested(host, response, context)) { this.log.Debug("Authentication required"); if (authState.GetState() == AuthProtocolState.Success) { authStrategy.AuthFailed(host, authState.GetAuthScheme(), context); } return(true); } else { switch (authState.GetState()) { case AuthProtocolState.Challenged: case AuthProtocolState.Handshake: { this.log.Debug("Authentication succeeded"); authState.SetState(AuthProtocolState.Success); authStrategy.AuthSucceeded(host, authState.GetAuthScheme(), context); break; } case AuthProtocolState.Success: { break; } default: { authState.SetState(AuthProtocolState.Unchallenged); break; } } return(false); } }
private OctaneServices(string url, long sharedspaceId, long workspaceId) { this.url = url; // create the authentication strategy based on saved configurations if (OctaneConfiguration.CredentialLogin) { authenticationStrategy = new LwssoAuthenticationStrategy(new UserPassConnectionInfo(OctaneConfiguration.Username, OctaneConfiguration.Password)); } else if (OctaneConfiguration.SsoLogin) { SsoAuthenticationStrategy ssoAuthenticationStrategy = new SsoAuthenticationStrategy(); ssoAuthenticationStrategy.SetConnectionListener(new SsoConnectionListener()); authenticationStrategy = ssoAuthenticationStrategy; } rest = new RestConnector(); es = new EntityService(rest); workspaceContext = new WorkspaceContext(sharedspaceId, workspaceId); sharedSpaceContext = new SharedSpaceContext(sharedspaceId); }
private void TestSlowRequestRateOnMultipleFailedAttemptsWhereAttemptIsValid(int maxFailedAttempts, Duration lockDuration) { // Given FakeClock clock = FakeClock; AuthenticationStrategy authStrategy = NewAuthStrategy(clock, maxFailedAttempts, lockDuration); User user = (new User.Builder("user", LegacyCredential.ForPassword("right"))).build(); // When we've failed max number of times for (int i = 0; i < maxFailedAttempts; i++) { assertThat(authStrategy.Authenticate(user, password("wrong")), equalTo(AuthenticationResult.FAILURE)); } // Then assertThat(authStrategy.Authenticate(user, password("right")), equalTo(AuthenticationResult.TOO_MANY_ATTEMPTS)); // But when time heals all wounds clock.Forward(lockDuration.plus(1, SECONDS)); // Then things should be alright assertThat(authStrategy.Authenticate(user, password("right")), equalTo(AuthenticationResult.SUCCESS)); }
public async Task <IEnumerable <IWord> > GetAsync(string partial, string locale = "en-GB") { var targetUri = GetUriWithParameters(partial, locale); _client.DefaultRequestHeaders.Authorization = AuthenticationStrategy.GetAuthenticationMethod(); var response = await _client.GetAsync(targetUri); var results = JsonConvert.DeserializeObject <List <string> >(await response.Content.ReadAsStringAsync()); var outputList = new List <IWord>(); foreach (var result in results) { var word = new Word() { Locale = locale, Value = result }; outputList.Add(word); } return(outputList); }
public override List <Contact> GetContacts() { Token token = ConnectionToken; List <Contact> contacts = new List <Contact>(); string response = ""; try { Stream responseStream = AuthenticationStrategy.ExecuteFeed(ContactsEndpoint, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { XDocument contactsXml = XDocument.Parse(response); IEnumerable <XElement> persons = contactsXml.Root.Elements("person"); foreach (var person in persons) { contacts.Add(new Contact() { ID = person.Element("id") != null ? person.Element("id").Value : "", ProfileURL = person.Element("public-profile-url") != null ? person.Element("public-profile-url").Value : "", Name = person.Element("first-name") != null ? person.Element("first-name").Value : "" + " " + person.Element("first-name") != null ? person.Element("last-name").Value : "" }); } logger.Info("Contacts successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ContactsParsingError(response), ex); throw new DataParsingException(ErrorMessages.ContactsParsingError(response), ex); } return(contacts); }
public MainClientExec(HttpRequestExecutor requestExecutor, HttpClientConnectionManager connManager, ConnectionReuseStrategy reuseStrategy, ConnectionKeepAliveStrategy keepAliveStrategy, AuthenticationStrategy targetAuthStrategy, AuthenticationStrategy proxyAuthStrategy, UserTokenHandler userTokenHandler) { Args.NotNull(requestExecutor, "HTTP request executor"); Args.NotNull(connManager, "Client connection manager"); Args.NotNull(reuseStrategy, "Connection reuse strategy"); Args.NotNull(keepAliveStrategy, "Connection keep alive strategy"); Args.NotNull(targetAuthStrategy, "Target authentication strategy"); Args.NotNull(proxyAuthStrategy, "Proxy authentication strategy"); Args.NotNull(userTokenHandler, "User token handler"); this.authenticator = new HttpAuthenticator(); this.proxyHttpProcessor = new ImmutableHttpProcessor(new RequestTargetHost(), new RequestClientConnControl()); this.routeDirector = new BasicRouteDirector(); this.requestExecutor = requestExecutor; this.connManager = connManager; this.reuseStrategy = reuseStrategy; this.keepAliveStrategy = keepAliveStrategy; this.targetAuthStrategy = targetAuthStrategy; this.proxyAuthStrategy = proxyAuthStrategy; this.userTokenHandler = userTokenHandler; }
public override WebResponse ExecuteFeed(string feedUrl, TRANSPORT_METHOD transportMethod) { return(AuthenticationStrategy.ExecuteFeed(feedUrl, this, ConnectionToken, transportMethod)); }
/// <summary> /// Returns a suffix for the generated artifacts which guarantees that they don't conflict with any /// existing artifacts in the project. /// </summary> private static string GetGeneratedArtifactSuffix(ConnectedServiceHandlerContext context, Project project, AuthenticationStrategy authStrategy) { using (XmlConfigHelper configHelper = context.CreateReadOnlyXmlConfigHelper()) { return GeneralUtilities.GetUniqueSuffix(suffix => { string serviceName = SalesforceConnectedServiceHandler.GetServiceInstanceName(suffix); return configHelper.IsPrefixUsedInAppSettings(serviceName) || (authStrategy == AuthenticationStrategy.WebServerFlow && configHelper.IsHandlerNameUsed(Constants.OAuthRedirectHandlerNameFormat.FormatInvariantCulture(serviceName))) || SalesforceConnectedServiceHandler.IsSuffixUsedInGeneratedFilesDirectories(context, serviceName, project); }); } }
public PasswordCheckStep(AuthenticationStrategy authenticationStrategy) : base(authenticationStrategy) { }
public virtual void LoginCallback(QueryParameters responseCollection, Action <bool, Token> AuthenticationHandler) { AuthenticationStrategy.ConnectionToken = this.ConnectionToken; AuthenticationStrategy.LoginCallback(responseCollection, AuthenticationHandler); }
public string GetLoginRedirectUrl(string returnUrl) { AuthenticationStrategy.ConnectionToken = ConnectionToken; return(AuthenticationStrategy.GetLoginUrl(returnUrl)); }