Package com.eviware.soapui.impl.rest

Examples of com.eviware.soapui.impl.rest.OAuth2Profile


    public void setUp() throws Exception {
        originalDialogs = UISupport.getDialogs();
        stubbedDialogs = new StubbedDialogs();
        UISupport.setDialogs(stubbedDialogs);
        OAuth2ProfileConfig configuration = OAuth2ProfileConfig.Factory.newInstance();
        profile = new OAuth2Profile(ModelItemFactory.makeOAuth2ProfileContainer(), configuration);

        clientFacade = mock(OAuth2ClientFacade.class);
        action = new RefreshOAuthAccessTokenAction(profile) {
            @Override
            protected OAuth2ClientFacade getOAuthClientFacade() {
View Full Code Here


    public void setUp() throws Exception {
        originalDialogs = UISupport.getDialogs();
        stubbedDialogs = new StubbedDialogs();
        UISupport.setDialogs(stubbedDialogs);
        OAuth2ProfileConfig configuration = OAuth2ProfileConfig.Factory.newInstance();
        profile = new OAuth2Profile(ModelItemFactory.makeOAuth2ProfileContainer(), configuration);
    }
View Full Code Here

        assertThat(httpRequest.getHeaders(OAuth.HeaderType.AUTHORIZATION), is(anEmptyArray()));
    }

    @Test
    public void automaticallyRefreshAccessTokenIfExpired() throws Exception {
        OAuth2Profile profileWithRefreshToken = setProfileWithRefreshTokenAndExpiredAccessToken();
        oAuth2FilterWithMockOAuth2ClientFacade(profileWithRefreshToken);
        oAuth2RequestFilter.filterRestRequest(mockContext, restRequest);

        String actualAccessTokenHeader = httpRequest.getHeaders((OAuth.HeaderType.AUTHORIZATION))[0].getValue();
        assertThat(actualAccessTokenHeader, is("Bearer " + OAuth2TestUtils.ACCESS_TOKEN));
View Full Code Here

        assertThat(actualAccessTokenHeader, is("Bearer " + OAuth2TestUtils.ACCESS_TOKEN));
    }

    @Test
    public void doesNotRefreshAccessTokenWhenRefreshMethodIsManual() throws SoapUIException {
        OAuth2Profile profileWithRefreshToken = setProfileWithRefreshTokenAndExpiredAccessToken();
        profileWithRefreshToken.setRefreshAccessTokenMethod(OAuth2Profile.RefreshAccessTokenMethods.MANUAL);
        oAuth2FilterWithMockOAuth2ClientFacade(profileWithRefreshToken);
        oAuth2RequestFilter.filterRestRequest(mockContext, restRequest);

        assertThat(profileWithRefreshToken.getAccessToken(), is(EXPIRED_TOKEN));
    }
View Full Code Here

        assertThat(profileWithRefreshToken.getAccessToken(), is(EXPIRED_TOKEN));
    }

    private OAuth2Profile setProfileWithRefreshTokenAndExpiredAccessToken() throws SoapUIException {
        final OAuth2Profile profileWithRefreshToken = OAuth2TestUtils.getOAuthProfileWithRefreshToken();
        setExpiredAccessToken(profileWithRefreshToken);

        oAuth2ProfileContainer.getOAuth2ProfileList().set(0, profileWithRefreshToken);
        restRequest.setSelectedAuthProfileAndAuthType(profileWithRefreshToken.getName(), O_AUTH_2_0);
        return profileWithRefreshToken;
    }
View Full Code Here

        realLogger = OAuth2RequestFilter.getLog();
        OAuth2RequestFilter.setLog(mockLogger);
    }

    private void setupProfileWithRefreshToken() throws SoapUIException {
        final OAuth2Profile profileWithRefreshToken = OAuth2TestUtils.getOAuthProfileWithRefreshToken();
        setExpiredAccessToken(profileWithRefreshToken);
        injectProfile(profileWithRefreshToken);

        oAuth2ProfileContainer.getOAuth2ProfileList().set(0, profileWithRefreshToken);
        oAuth2Profile = profileWithRefreshToken;
View Full Code Here

            }
        };
    }

    private void setupProfileWithAutomationScripts() throws SoapUIException {
        final OAuth2Profile profileWithAutomationScripts = makeProfileWithAutomationScripts();
        setExpiredAccessToken(profileWithAutomationScripts);
        injectProfile(profileWithAutomationScripts);
        oAuth2FilterWithMockOAuth2ClientFacade(profileWithAutomationScripts);
        Runnable browserCallbackSimulator = new Runnable() {
            public void run() {
                try {
                    Thread.sleep(50);
                } catch (InterruptedException ignore) {

                }
                profileWithAutomationScripts.applyRetrievedAccessToken(RETRIEVED_ACCESS_TOKEN);
            }
        };
        new Thread(browserCallbackSimulator).start();
    }
View Full Code Here

                CredentialsConfig.AuthType.O_AUTH_2_0);
        oAuth2Profile = profileWithAutomationScripts;
    }

    private OAuth2Profile makeProfileWithAutomationScripts() throws SoapUIException {
        final OAuth2Profile profileWithAutomationScripts = OAuth2TestUtils.getOAuthProfileWithDefaultValues();
        profileWithAutomationScripts.setAutomationJavaScripts(Arrays.asList("doLoginAndConsent()"));
        return profileWithAutomationScripts;
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.rest.OAuth2Profile

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.