Package org.apache.oltu.oauth2.client.response

Examples of org.apache.oltu.oauth2.client.response.OAuthClientResponse


            .setGrantType(GrantType.PASSWORD)
            .setClientId(Common.CLIENT_ID)
            .buildBodyMessage();

        OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
        OAuthClientResponse response = null;

        try {
            oAuthClient.accessToken(request);
            fail("exception expected");
        } catch (OAuthProblemException e) {
View Full Code Here


            .setUsername(Common.USERNAME)
            .setPassword(Common.PASSWORD)
            .buildBodyMessage();

        OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
        OAuthClientResponse response = null;

        try {
            oAuthClient.accessToken(request);
            fail("exception expected");
        } catch (OAuthProblemException e) {
View Full Code Here

    @GET
    @Path("/redirect")
    public Response callback(@Context HttpServletRequest request) throws Exception {

        OAuthClientResponse resp = null;
        try {
            OAuthAuthzResponse.oauthCodeAuthzResponse(request);
            fail("exception expected");
        } catch (OAuthProblemException e) {
            assertEquals(OAuthError.CodeResponse.INVALID_REQUEST, e.getError());
View Full Code Here

    @GET
    @Path("/redirect1")
    public Response callback1(@Context HttpServletRequest request) throws Exception {

        OAuthClientResponse resp = null;
        try {
            OAuthAuthzResponse.oauthCodeAuthzResponse(request);
        } catch (OAuthProblemException e) {
            fail("exception not expected");
        }
View Full Code Here

*/
public class OAuthClientResponseFactoryTest {

    @Test
    public void testCreateGitHubTokenResponse() throws Exception {
        OAuthClientResponse gitHubTokenResponse = OAuthClientResponseFactory
            .createGitHubTokenResponse("access_token=123", OAuth.ContentType.URL_ENCODED, 200);
        Assert.assertNotNull(gitHubTokenResponse);
    }
View Full Code Here

        Assert.assertNotNull(gitHubTokenResponse);
    }

    @Test
    public void testCreateJSONTokenResponse() throws Exception {
        OAuthClientResponse jsonTokenResponse = OAuthClientResponseFactory
            .createJSONTokenResponse("{'access_token':'123'}", OAuth.ContentType.JSON, 200);
        Assert.assertNotNull(jsonTokenResponse);
    }
View Full Code Here

            //生成授权码
            String authorizationCode = null;
            //responseType目前仅支持CODE,另外还有TOKEN
            String responseType = oauthRequest.getParam(OAuth.OAUTH_RESPONSE_TYPE);
            if (responseType.equals(ResponseType.CODE.toString())) {
                OAuthIssuerImpl oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
                authorizationCode = oauthIssuerImpl.authorizationCode();
                oAuthService.addAuthCode(authorizationCode, username);
            }

            //进行OAuth响应构建
View Full Code Here

                    return new ResponseEntity(response.getBody(), HttpStatus.valueOf(response.getResponseStatus()));
                }
            }

            //生成Access Token
            OAuthIssuer oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
            final String accessToken = oauthIssuerImpl.accessToken();
            oAuthService.addAccessToken(accessToken, oAuthService.getUsernameByAuthCode(authCode));


            //生成OAuth响应
View Full Code Here

                    return new ResponseEntity(response.getBody(), HttpStatus.valueOf(response.getResponseStatus()));
                }
            }

            //生成Access Token
            OAuthIssuer oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
            final String accessToken = oauthIssuerImpl.accessToken();
            oAuthService.addAccessToken(accessToken, oAuthService.getUsernameByAuthCode(authCode));


            //生成OAuth响应
            OAuthResponse response = OAuthASResponse
View Full Code Here

            //生成授权码
            String authorizationCode = null;
            //responseType目前仅支持CODE,另外还有TOKEN
            String responseType = oauthRequest.getParam(OAuth.OAUTH_RESPONSE_TYPE);
            if (responseType.equals(ResponseType.CODE.toString())) {
                OAuthIssuerImpl oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
                authorizationCode = oauthIssuerImpl.authorizationCode();
                oAuthService.addAuthCode(authorizationCode, username);
            }

            //进行OAuth响应构建
            OAuthASResponse.OAuthAuthorizationResponseBuilder builder =
View Full Code Here

TOP

Related Classes of org.apache.oltu.oauth2.client.response.OAuthClientResponse

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.