Package com.force.sdk.connector

Examples of com.force.sdk.connector.ForceConnectorConfig


        HttpServletResponse res = (HttpServletResponse) response;

        //If a user has been authenticated then the information about that user must be stored
        if (auth != null && auth.getPrincipal() instanceof ForceUserPrincipal) {
            ForceUserPrincipal user = (ForceUserPrincipal) auth.getPrincipal();
            ForceConnectorConfig cc = new ForceConnectorConfig();
            cc.setSessionId(user.getSessionId());
            SecurityContext sc = (SecurityContext) auth.getDetails();
            cc.setServiceEndpoint(sc.getEndPoint());
            cc.setSessionRenewer(this);
            //The security context holder handles the storage of the security context
            ForceSecurityContextHolder.set(sc);

            //The ForceServiceConnector handles the storage of the connector config and will use this config going forward
            ForceServiceConnector.setThreadLocalConnectorConfig(cc);
View Full Code Here


    @Test(dataProvider = "connectionConstructOrderProvider")
    public void testConnectionConstructOrder(String testName, Boolean addGoodThreadLocal,
            Boolean addGoodConnUrl, Boolean addGoodUserInfo) throws Exception {
        try {
            if (addGoodThreadLocal != null && addGoodThreadLocal) {
                ForceConnectorConfig config = new ForceConnectorConfig();
                config.setAuthEndpoint(userInfo.getServerEndpoint());
                config.setUsername(userInfo.getUserName());
                config.setPassword(userInfo.getPassword());
               
                ForceServiceConnector.setThreadLocalConnectorConfig(config);
            }
           
            Map<String, String> persistencePropMap = new HashMap<String, String>();
View Full Code Here

           
        ForceServiceConnector connector = new ForceServiceConnector();
       
        // A ConnectorConfig might have been set via OAuth in which case we should be
        // using that.
        ForceConnectorConfig tlConfig;
        if ((tlConfig = ForceServiceConnector.getThreadLocalConnectorConfig()) != null) {
            connector.setConnectorConfig(tlConfig);
        } else {
            connector.setConnectorConfig(storeManager.getConfig());
        }
View Full Code Here

    }
   
    @BeforeClass
    public void loadPersistenceUnit() throws Exception {
        UserInfo info = BaseJPAFTest.getDefaultUserInfoFromContext();
        ForceConnectorConfig cc = new ForceConnectorConfig();
        cc.setUsername(info.getUserName());
        cc.setPassword(info.getPassword());
        cc.setAuthEndpoint(info.getServerEndpoint());
        BaseJPAFTest.populateTestContext(getTestName(), info);
    }
View Full Code Here

     * Helper to retrieve the namespace of the org stored in the current test context.
     * @return String containing the namespace
     */
    public static String getNamespaceFromCtx() throws ConnectionException {
        UserInfo info = TestContext.get().getUserInfo();
        ForceConnectorConfig config = new ForceConnectorConfig();
        config.setAuthEndpoint(info.getServerEndpoint());
        config.setUsername(info.getUserName());
        config.setPassword(info.getPassword());
        ForceServiceConnector connector = new ForceServiceConnector(config);
        return connector.getNamespace();
    }
View Full Code Here

       
        // Grab the connection information from persistence.xml.  If none exists,
        // we'll use the unit name (see ForceMetaDataManager.loadPersistenceUnit
        // and ForceConnectionFactory.createManagedConnection).
        if (endpoint != null) {
            config = new ForceConnectorConfig();
           
            // Treat any url starting with force:// as a connection url
            if (endpoint.startsWith(FORCE_PREFIX)) {
                config.setConnectionUrl(endpoint);
            // Any other endpoint, we'll treat as a normal Force.com API url
View Full Code Here

            securityContextService.setSecurityContextToSession(request, response, sc);
        }
       
        ForceSecurityContextHolder.set(sc);
       
        ForceConnectorConfig cc = new ForceConnectorConfig();
        cc.setSessionId(sc.getSessionId());
        cc.setServiceEndpoint(sc.getEndPoint());
        cc.setSessionRenewer(this);

        try {
            ForceServiceConnector.setThreadLocalConnectorConfig(cc);
            request.setAttribute(FILTER_ALREADY_VISITED, Boolean.TRUE);
            chain.doFilter(new AuthenticatedRequestWrapper(request, sc), response);
View Full Code Here

        throws IOException, ServletException {
       
        HttpServletRequest req = (HttpServletRequest) request;
        HttpServletResponse res = (HttpServletResponse) response;
       
        ForceConnectorConfig config = new ForceConnectorConfig();
        try {
            config.setServiceEndpoint(sc.getEndPoint());
            config.setSessionId(sc.getSessionId());
            config.setSessionRenewer(this);
            ForceServiceConnector connector = new ForceServiceConnector();
            connector.setConnectorConfig(config);
            //logout from the partner API
            connector.getConnection().logout();
        } catch (ConnectionException e) {
View Full Code Here

    @Override
    public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
        if (authentication == null || authentication.getDetails() == null
                || !(authentication.getDetails() instanceof SecurityContext)) return;
        ForceConnectorConfig config = new ForceConnectorConfig();
        try {
            SecurityContext sc = ((SecurityContext) authentication.getDetails());
            // Use the value from session and not the login endpoint
            request.setAttribute(LogoutSuccessHandler.FORCE_ENDPOINT_ATTRIBUTE, sc.getEndPoint());
            config.setServiceEndpoint(sc.getEndPoint());
            config.setSessionId(sc.getSessionId());
            config.setSessionRenewer(this);
            ForceServiceConnector connector = new ForceServiceConnector();
            connector.setConnectorConfig(config);
            //logout from the partner API
            connector.getConnection().logout();
        } catch (ConnectionException e) {
            if (config.getSessionId() != null) {
                // If the session id is null that means we visited the renewer method below and the session is dead anyways
                throw new AuthenticationServiceException("Unable to logout from Salesforce", e);
            }
        }
    }
View Full Code Here

            }
        }
    }
   
    private PartnerConnection getPartnerConnection() throws ConnectionException {
        ForceConnectorConfig config = new ForceConnectorConfig();
        config.setAuthEndpoint(TestContext.get().getUserInfo().getServerEndpoint());
        config.setUsername(TestContext.get().getUserInfo().getUserName());
        config.setPassword(TestContext.get().getUserInfo().getPassword());
        return new ForceServiceConnector(config).getConnection();
    }
View Full Code Here

TOP

Related Classes of com.force.sdk.connector.ForceConnectorConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.