Package org.apache.oltu.oauth2.client.request.OAuthClientRequest

Examples of org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder


    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


        assertEquals("RS256", header.getAlgorithm());
    }

    @Test
    public void testClaimsSet() throws Exception {
        ClaimsSet claimsSet = jwt.getClaimsSet();
        assertEquals("788732372078.apps.googleusercontent.com", claimsSet.getAudience());
        assertEquals("accounts.google.com", claimsSet.getIssuer());
        assertEquals("106422453082479998429", claimsSet.getSubject());
        assertEquals(1366730217, claimsSet.getExpirationTime());
        assertEquals(1366726317, claimsSet.getIssuedAt());
    }
View Full Code Here

        assertEquals(JWT, jwt.getRawString());
    }

    @Test
    public void testHeader() throws Exception {
        Header header = jwt.getHeader();
        assertEquals("RS256", header.getAlgorithm());
    }
View Full Code Here

public final class JWTWriterTestCase implements IOTestCaseConstants {

    @Test
    public void write() {
        JWT jwt = new JWT.Builder()
                          // header
                          .setHeaderAlgorithm("RS256")
                          .setHeaderCustomField("kid", "be1da0b3567bd265a25098fbcc2b09f21345b3a2")
                          // claimset
                          .setClaimsSetAudience("788732372078.apps.googleusercontent.com")
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

TOP

Related Classes of org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder

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.