Package org.apache.amber.oauth2.ext.dynamicreg.server.request

Examples of org.apache.amber.oauth2.ext.dynamicreg.server.request.JSONHttpServletRequestWrapper


    public Response register(@Context HttpServletRequest request) throws OAuthSystemException {


        OAuthServerRegistrationRequest oauthRequest = null;
        try {
            oauthRequest = new OAuthServerRegistrationRequest(new JSONHttpServletRequestWrapper(request));
            oauthRequest.discover();
            oauthRequest.getClientName();
            oauthRequest.getClientUrl();
            oauthRequest.getClientDescription();
            oauthRequest.getRedirectURI();
View Full Code Here


    @Consumes("application/json")
    @Produces("application/json")
    public Response register(@Context HttpServletRequest request) throws OAuthSystemException {


        OAuthServerRegistrationRequest oauthRequest = null;
        try {
            oauthRequest = new OAuthServerRegistrationRequest(new JSONHttpServletRequestWrapper(request));
            oauthRequest.discover();
            oauthRequest.getClientName();
            oauthRequest.getClientUrl();
            oauthRequest.getClientDescription();
            oauthRequest.getRedirectURI();

            OAuthResponse response = OAuthServerRegistrationResponse
                .status(HttpServletResponse.SC_OK)
                .setClientId(CommonExt.CLIENT_ID)
                .setClientSecret(CommonExt.CLIENT_SECRET)
View Full Code Here

    public Response get(@Context HttpServletRequest request) throws OAuthSystemException {

        try {

            // Make the OAuth Request out of this request
            OAuthAccessResourceRequest oauthRequest = new OAuthAccessResourceRequest(request,
                ParameterStyle.HEADER);

            // Get the access token
            String accessToken = oauthRequest.getAccessToken();

            // Validate the access token
            if (!Common.ACCESS_TOKEN_VALID.equals(accessToken)) {

                // Return the OAuth error message
View Full Code Here

    public Response get(@Context HttpServletRequest request) throws OAuthSystemException {

        try {

            // Make the OAuth Request out of this request
            OAuthAccessResourceRequest oauthRequest = new OAuthAccessResourceRequest(request,
                ParameterStyle.QUERY);

            // Get the access token
            String accessToken = oauthRequest.getAccessToken();

            // Validate the access token
            if (!Common.ACCESS_TOKEN_VALID.equals(accessToken)) {

                // Return the OAuth error message
View Full Code Here

    public Response get(@Context HttpServletRequest request) throws OAuthSystemException {

        try {

            // Make the OAuth Request out of this request and validate it
            OAuthAccessResourceRequest oauthRequest = new OAuthAccessResourceRequest(request,
                ParameterStyle.BODY);

            // Get the access token
            String accessToken = oauthRequest.getAccessToken();

            // Check if the token is valid
            if (Common.ACCESS_TOKEN_VALID.equals(accessToken)) {

                // Return the resource
View Full Code Here

    public Response register(@Context HttpServletRequest request) throws OAuthSystemException {


        OAuthServerRegistrationRequest oauthRequest = null;
        try {
            oauthRequest = new OAuthServerRegistrationRequest(new JSONHttpServletRequestWrapper(request));
            oauthRequest.discover();
            oauthRequest.getClientName();
            oauthRequest.getClientUrl();
            oauthRequest.getClientDescription();
            oauthRequest.getRedirectURI();
View Full Code Here

        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/oauth/register");
        request.setContentType(OAuth.ContentType.JSON);
        request.setContent(validJson.getBytes("UTF-8"));

        final JSONHttpServletRequestWrapper jsonWrapper = new JSONHttpServletRequestWrapper(request);
        OAuthServerRegistrationRequest registrationRequest = new OAuthServerRegistrationRequest(jsonWrapper);

        Assert.assertEquals("Uploading and also editing capabilities!",
            registrationRequest.getClientDescription());
        Assert.assertEquals("http://onlinephotogallery.com/icon.png", registrationRequest.getClientIcon());
View Full Code Here

    @Test(expected = OAuthProblemException.class)
    public void testInvalidContentTypePushRequest() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/oauth/register");
        request.setContentType(OAuth.ContentType.URL_ENCODED);

        final JSONHttpServletRequestWrapper jsonWrapper = new JSONHttpServletRequestWrapper(request);
        OAuthServerRegistrationRequest registrationRequest = new OAuthServerRegistrationRequest(jsonWrapper);
    }
View Full Code Here

    @Test(expected = OAuthProblemException.class)
    public void testInvalidMethodPushRequest() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/oauth/register");
        request.setContentType(OAuth.ContentType.JSON);

        final JSONHttpServletRequestWrapper jsonWrapper = new JSONHttpServletRequestWrapper(request);
        OAuthServerRegistrationRequest registrationRequest = new OAuthServerRegistrationRequest(jsonWrapper);
    }
View Full Code Here

        final String inValidJson = FileUtils.readTextFileAsString("json/push_invalid.json");
        MockHttpServletRequest request = new MockHttpServletRequest("POST", "/oauth/register");
        request.setContentType(OAuth.ContentType.JSON);
        request.setContent(inValidJson.getBytes("UTF-8"));

        final JSONHttpServletRequestWrapper jsonWrapper = new JSONHttpServletRequestWrapper(request);
        OAuthServerRegistrationRequest registrationRequest = new OAuthServerRegistrationRequest(jsonWrapper);
    }
View Full Code Here

TOP

Related Classes of org.apache.amber.oauth2.ext.dynamicreg.server.request.JSONHttpServletRequestWrapper

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.