Examples of OAuth2Adapter


Examples of org.mule.security.oauth.OAuth2Adapter

        final String redirectUri = "redirectUri";
        final String accessTokenId = "accessTokenId";

        this.processor.setRedirectUri(redirectUri);

        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);

        Mockito.when(this.manager.createAdapter(verifier)).thenReturn(adapter);
        Mockito.when(this.manager.getDefaultUnauthorizedConnector().getName()).thenReturn(accessTokenId);
        Mockito.when(adapter.getAccessTokenUrl()).thenReturn(accessTokenUrl);

        Assert.assertSame(this.event, this.processor.process(this.event));
    }
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

        final String redirectUri = "redirectUri";
        final String accessTokenId = "accessTokenId";

        this.processor.setRedirectUri(redirectUri);

        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);

        Mockito.when(this.manager.createAdapter(verifier)).thenReturn(adapter);
        Mockito.when(this.manager.getDefaultUnauthorizedConnector().getName()).thenReturn(accessTokenId);
        Mockito.when(adapter.getAccessTokenUrl()).thenReturn(accessTokenUrl);

        Assert.assertSame(this.restoredEvent, this.processor.process(event));

        Mockito.verify(adapter).fetchAccessToken(redirectUri);
        Mockito.verify(this.manager.getAccessTokenPoolFactory()).passivateObject(accessTokenId, adapter);
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

        final String accessTokenId = "accessTokenId";

        this.processor.setRedirectUri(redirectUri);
        this.processor.setAccessTokenUrl(accessTokenUrl);

        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);

        Mockito.when(this.manager.createAdapter(verifier)).thenReturn(adapter);
        Mockito.when(this.manager.getDefaultUnauthorizedConnector().getName()).thenReturn(accessTokenId);

        Assert.assertSame(this.restoredEvent, this.processor.process(event));
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

        final String accessTokenId = "accessTokenId";

        this.processor.setRedirectUri(redirectUri);
        this.processor.setAccessTokenId(accessTokenId);

        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);

        Mockito.when(this.manager.createAdapter(verifier)).thenReturn(adapter);
        Mockito.when(adapter.getAccessTokenUrl()).thenReturn(accessTokenUrl);

        Assert.assertSame(this.restoredEvent, this.processor.process(event));

        Mockito.verify(adapter).fetchAccessToken(redirectUri);
        Mockito.verify(this.manager.getAccessTokenPoolFactory()).passivateObject(accessTokenId, adapter);
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

        this.processor.setRedirectUri(redirectUri);
        this.processor.setAccessTokenUrl(accessTokenUrl);
        this.processor.setAccessTokenId(accessTokenId);

        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);

        Mockito.when(this.manager.createAdapter(verifier)).thenReturn(adapter);

        Assert.assertSame(this.restoredEvent, this.processor.process(event));
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

    }

    @Test
    public void unprotected() throws Exception
    {
        OAuth2Adapter adapter = Mockito.mock(OAuth2Adapter.class);
        Mockito.when(this.manager.getDefaultUnauthorizedConnector()).thenReturn(adapter);
        Mockito.when(this.callback.isProtected()).thenReturn(false);

        this.interceptor.execute(callback, this.adapter, (MessageProcessor) this.processor, this.event);
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

    public T execute(ProcessCallback<T, OAuth2Adapter> processCallback,
                     OAuth2Adapter object,
                     MessageProcessor messageProcessor,
                     MuleEvent event) throws Exception
    {
        OAuth2Adapter connector = null;
        if (!processCallback.isProtected())
        {
            return processCallback.process(this.oauthManager.getDefaultUnauthorizedConnector());
        }
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

            if (logger.isDebugEnabled())
            {
                logger.debug("Attempting to acquire access token using from store for user " + accessTokenId);
            }

            OAuth2Adapter connector = manager.acquireAccessToken(accessTokenId);

            if (connector == null)
            {
                throw new UnableToAcquireConnectionException();
            }
View Full Code Here

Examples of org.mule.security.oauth.OAuth2Adapter

        MuleEvent restoredEvent = this.restoreOriginalEvent(event);
        this.notifyCallbackReception(event);

        try
        {
            OAuth2Adapter oauthAdapter = this.oauthManager.createAdapter(((String) event.getMessage()
                .getInvocationProperty(OAuthProperties.VERIFIER)));

            if (oauthAdapter.getAccessTokenUrl() == null)
            {
                oauthAdapter.setAccessTokenUrl(this.getAccessTokenUrl());
            }
            oauthAdapter.fetchAccessToken(this.getRedirectUri());

            String transformedAccessTokenId = this.getAccessTokenId();

            if (StringUtils.isEmpty(transformedAccessTokenId))
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.