Examples of OAuthServerRequest


Examples of com.sun.jersey.oauth.server.OAuthServerRequest

    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_FORM_URLENCODED)
    public Response postAccessTokenRequest(@Context HttpContext hc, @Context Request req) {
        try {
            boolean sigIsOk = false;
            OAuthServerRequest request = new OAuthServerRequest(hc.getRequest());
            OAuthParameters params = new OAuthParameters();
            params.readRequest(request);

            if (params.getToken() == null) {
                throw new WebApplicationException(new Throwable("oauth_token MUST be present."), 400);
View Full Code Here

Examples of com.sun.jersey.oauth.server.OAuthServerRequest

        request.setSecurityContext(sc);
        return request;
    }

    private OAuthSecurityContext getSecurityContext(ContainerRequest request) throws OAuthException {
        OAuthServerRequest osr = new OAuthServerRequest(request);
        OAuthParameters params = new OAuthParameters().readRequest(osr);

        // apparently not signed with any OAuth parameters; unauthorized
        if (params.size() == 0) {
            throw newUnauthorizedException();
View Full Code Here

Examples of com.sun.jersey.oauth.server.OAuthServerRequest

    @POST
    @Consumes("application/x-www-form-urlencoded")
    @Produces("application/x-www-form-urlencoded")
    public Response postReqTokenRequest() {
        try {
            OAuthServerRequest request = new OAuthServerRequest(hc.getRequest());
            OAuthParameters params = new OAuthParameters();
            params.readRequest(request);

            String tok = params.getToken();
            if ((tok != null) && (!tok.contentEquals(""))) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }

            String consKey = params.getConsumerKey();
            if (consKey == null) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }

            OAuthConsumer consumer = provider.getConsumer(consKey);
            if (consumer == null) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }
            OAuthSecrets secrets = new OAuthSecrets().consumerSecret(consumer.getSecret()).tokenSecret("");

            boolean sigIsOk = false;
            try {
                sigIsOk = OAuthSignature.verify(request, params, secrets);
            } catch (OAuthSignatureException ex) {
                Logger.getLogger(RequestTokenRequest.class.getName()).log(Level.SEVERE, null, ex);
            }

            if (!sigIsOk) {
                throw new OAuthException(Response.Status.BAD_REQUEST, null);
            }

            MultivaluedMap<String, String> parameters = new MultivaluedMapImpl();
            for (String n : request.getParameterNames()) {
                parameters.put(n, request.getParameterValues(n));
            }

            OAuthToken rt = provider.newRequestToken(consKey, params.getCallback(), parameters);

            Form resp = new Form();
View Full Code Here

Examples of org.glassfish.jersey.server.oauth1.internal.OAuthServerRequest

        request.setSecurityContext(sc);
    }


    private OAuth1SecurityContext getSecurityContext(ContainerRequestContext request) throws OAuth1Exception {
        OAuthServerRequest osr = new OAuthServerRequest(request);
        OAuth1Parameters params = new OAuth1Parameters().readRequest(osr);

        // apparently not signed with any OAuth parameters; unauthorized
        if (params.size() == 0) {
            throw newUnauthorizedException();
View Full Code Here

Examples of org.glassfish.jersey.server.oauth1.internal.OAuthServerRequest

    public String handle(
            @QueryParam("file") String file,
            @QueryParam("size") String size,
            @Context ContainerRequestContext request) {

        OAuthServerRequest osr = new OAuthServerRequest(request);

        OAuth1Secrets secrets = new OAuth1Secrets().
                consumerSecret("kd94hf93k423kf44").tokenSecret("pfkkdhi9sl3r4s00");

        OAuth1Parameters params = new OAuth1Parameters().readRequest(osr);
View Full Code Here

Examples of org.glassfish.jersey.server.oauth1.internal.OAuthServerRequest

    @POST
    @Produces("text/plain")
    public String get(@Context ContainerRequestContext request) {

        OAuthServerRequest osr = new OAuthServerRequest(request);

        OAuth1Secrets secrets = new OAuth1Secrets().consumerSecret("kd94hf93k423kf44");

        OAuth1Parameters params = new OAuth1Parameters().readRequest(osr);
View Full Code Here

Examples of org.glassfish.jersey.server.oauth1.internal.OAuthServerRequest

    @POST
    @Produces("text/plain")
    public String post(@Context ContainerRequestContext request) {

        OAuthServerRequest osr = new OAuthServerRequest(request);

        OAuth1Secrets secrets = new OAuth1Secrets().
                consumerSecret("kd94hf93k423kf44").tokenSecret("hdhd0244k9j7ao03");

        OAuth1Parameters params = new OAuth1Parameters().readRequest(osr);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.