Package org.apache.amber.oauth2.client.demo.exception

Examples of org.apache.amber.oauth2.client.demo.exception.ApplicationException


            .setDescription(CommonExt.APP_DESCRIPTION)
            .setIcon(CommonExt.APP_ICON)
            .setRedirectURL(CommonExt.APP_REDIRECT_URI)
            .buildJSONMessage();

        OAuthRegistrationClient oauthclient = new OAuthRegistrationClient(new URLConnectionClient());
        OAuthClientRegistrationResponse response = oauthclient.clientInfo(request);

        assertEquals(CommonExt.CLIENT_ID, response.getClientId());
        assertEquals(CommonExt.CLIENT_SECRET, response.getClientSecret());
        assertEquals(CommonExt.EXPIRES_IN, response.getExpiresIn());
View Full Code Here


            .setDescription(CommonExt.APP_DESCRIPTION)
            .setIcon(CommonExt.APP_ICON)
            .setRedirectURL(CommonExt.APP_REDIRECT_URI)
            .buildBodyMessage();

        OAuthRegistrationClient oauthclient = new OAuthRegistrationClient(new URLConnectionClient());
        try {
            OAuthClientRegistrationResponse response = oauthclient.clientInfo(request);
            fail("exception expected");
        } catch (OAuthProblemException e) {
            assertNotNull(e.getError());
View Full Code Here

            if (isEmpty(description)) {
                sb.append("Application URL ");
            }
        } else if (!REG_TYPE_PULL.equals(regType)) {
            throw new ApplicationException("Incorrect registration type: " + regType);
        }

        String incorrectParams = sb.toString();
        if ("".equals(incorrectParams)) {
            return;
        }
        throw new ApplicationException("Incorrect parameters: " + incorrectParams);

    }
View Full Code Here

        String incorrectParams = sb.toString();
        if ("".equals(incorrectParams)) {
            return;
        }
        throw new ApplicationException("Incorrect parameters: " + incorrectParams);

    }
View Full Code Here

        String incorrectParams = sb.toString();
        if ("".equals(incorrectParams)) {
            return;
        }
        throw new ApplicationException("Incorrect parameters: " + incorrectParams);

    }
View Full Code Here

    }

    @Test
    public void testSuccessfullAccesToken() throws Exception {

        OAuthClientRequest request = OAuthClientRequest
            .tokenLocation(Common.ACCESS_TOKEN_ENDPOINT)
            .setGrantType(GrantType.PASSWORD)
            .setClientId(Common.CLIENT_ID)
            .setClientSecret(Common.CLIENT_SECRET)
            .setUsername(Common.USERNAME)
View Full Code Here

    }

    @Test
    public void testInvalidRequest() throws Exception {

        OAuthClientRequest request = OAuthClientRequest
            .tokenLocation(Common.ACCESS_TOKEN_ENDPOINT)
            .setGrantType(GrantType.PASSWORD)
            .setClientId(Common.CLIENT_ID)
            .buildBodyMessage();
View Full Code Here

    }

    @Test
    public void testInvalidClient() throws Exception {
        OAuthClientRequest request = OAuthClientRequest
            .tokenLocation(Common.ACCESS_TOKEN_ENDPOINT)
            .setGrantType(GrantType.PASSWORD)
            .setClientId("wrong_client_id")
            .setClientSecret(Common.CLIENT_SECRET)
            .setUsername(Common.USERNAME)
View Full Code Here

    @Test
    public void testWrongParametersEndUserAuthorization() throws Exception {


        OAuthClientRequest request = OAuthClientRequest
            .authorizationLocation(Common.AUTHORIZATION_ENPOINT)
            .setClientId(Common.CLIENT_ID)
            .setRedirectURI(Common.REDIRECT_URL)
            .buildQueryMessage();
View Full Code Here

    }

    @Test
    public void testCorrectParametersEndUserAuthorization() throws Exception {

        OAuthClientRequest request = OAuthClientRequest
            .authorizationLocation(Common.AUTHORIZATION_ENPOINT)
            .setClientId(Common.CLIENT_ID)
            .setRedirectURI(Common.REDIRECT_URL + "1")
            .setResponseType(ResponseType.CODE.toString())
            .buildQueryMessage();
View Full Code Here

TOP

Related Classes of org.apache.amber.oauth2.client.demo.exception.ApplicationException

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.