Package org.apache.oltu.oauth2.rs.request

Examples of org.apache.oltu.oauth2.rs.request.OAuthAccessResourceRequest


            .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


    public OAuthClientRegistrationResponse() {
    }

    @Override
    protected void init(String body, String contentType, int responseCode) throws OAuthProblemException {
        validator = new RegistrationValidator();
        super.init(body, contentType, responseCode);
    }
View Full Code Here

    @RequestMapping("/userInfo")
    public HttpEntity userInfo(HttpServletRequest request) throws OAuthSystemException {
        try {

            //构建OAuth资源请求
            OAuthAccessResourceRequest oauthRequest = new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            //获取Access Token
            String accessToken = oauthRequest.getAccessToken();

            //验证Access Token
            if (!oAuthService.checkAccessToken(accessToken)) {
                // 如果不存在/过期了,返回未验证错误,需重新验证
                OAuthResponse oauthResponse = OAuthRSResponse
View Full Code Here

        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION)).andStubReturn("Bearer sadfasfd");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY, ParameterStyle.HEADER);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

        expect(request.getHeader(OAuth.HeaderType.AUTHORIZATION))
            .andStubReturn("Bearer sadfasfd,oauth_signature_method=\"HMAC-SHA1\"");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY, ParameterStyle.HEADER);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

        expect(request.getParameterValues(OAuth.OAUTH_TOKEN)).andStubReturn(null);
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertNotNull(e);
        }
        verify(request);
View Full Code Here

                                                                                                 "othertoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
        } catch (OAuthProblemException e) {
            fail("Exception not expected");
        }
        verify(request);
View Full Code Here

        //        expect(request.getParameterValues(OAuth.OAUTH_TOKEN)).andStubReturn(null);
        //        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn(null);
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            fail("Exception expected");
        } catch (OAuthProblemException e) {
            Assert.assertNull(e.getError());
        }
        verify(request);
View Full Code Here

        //        expect(request.getParameterValues(OAuth.OAUTH_BEARER_TOKEN)).andStubReturn(new String[] {"sometoken"});
        //        expect(request.getParameter(OAuth.OAUTH_VERSION_DIFFER)).andStubReturn("HMAC-SHA1");
        replay(request);

        try {
            new OAuthAccessResourceRequest(request, ParameterStyle.QUERY);
            fail("Exception expeted");
        } catch (OAuthProblemException e) {
            Assert.assertTrue(OAuthError.TokenResponse.INVALID_REQUEST.equals(e.getError()));
        }
        verify(request);
View Full Code Here

TOP

Related Classes of org.apache.oltu.oauth2.rs.request.OAuthAccessResourceRequest

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.