Package com.cloudbees.api.oauth

Examples of com.cloudbees.api.oauth.OauthClientException


    String pack(TokenRequest req) throws OauthClientException {
        try {
            return CREATE_TOKEN + MAPPER.writeValueAsString(req);
        } catch (IOException e) {
            throw new OauthClientException("Failed to marshal TokenRequest",e);
        }
    }
View Full Code Here


    TokenRequest unpackCreateToken(String packed) throws OauthClientException {
        try {
            return MAPPER.readValue(packed.substring(CREATE_TOKEN.length()), TokenRequest.class);
        } catch (IOException e) {
            throw new OauthClientException("Failed to unmarshal TokenRequest",e);
        }
    }
View Full Code Here

                t = this.cache.get(p).get();
            }
            return t;
        } catch (ExecutionException e) {
            // not unwrapping an exception to capture the call stack
            throw new OauthClientException(e);
        }
    }
View Full Code Here

                return null;
            }
            return t;
        } catch (ExecutionException e) {
            // not unwrapping an exception to capture the call stack
            throw new OauthClientException(e);
        }
    }
View Full Code Here

    public OauthToken createToken(TokenRequest tokenRequest) throws OauthClientException {
        try{
            OauthTokenDetail resp = bees.jsonPOJORequest(gcUrl + "/api/v2/authorizations", tokenRequest, OauthTokenDetail.class, "POST");
            return toToken(resp);
        }catch(IOException e){
            throw new OauthClientException("Failed to create token. "+e.getMessage(), e);
        }
    }
View Full Code Here

            for (OauthTokenDetail d : rsp.authorized_tokens) {
                d.owner = this;
            }
            return rsp.authorized_tokens;
        } catch(IOException e) {
            throw new OauthClientException("Failed to list up tokens. "+e.getMessage(), e);
        }
    }
View Full Code Here

    public void deleteToken(String oauthTokenId) throws OauthClientException {
        try {
            bees.jsonPOJORequest(gcUrl + "/api/v2/authorizations/"+oauthTokenId, null, null, "DELETE");
        } catch (IOException e) {
            throw new OauthClientException("Failed to delete OAuth token",e);
        }
    }
View Full Code Here

    public void deleteApplication(String clientId) throws OauthClientException {
        try {
            bees.jsonPOJORequest(gcUrl + "/api/v2/applications/"+clientId, null, null, "DELETE");
        } catch (IOException e) {
            throw new OauthClientException("Failed to delete OAuth application",e);
        }
    }
View Full Code Here

                params.put("redirect_uri", singletonList(redirectUri));

            OauthToken resp = bees.formUrlEncoded(gcUrl+"/oauth/token", null, params).bind(OauthToken.class,bees);
            return resp;
        } catch (IOException e) {
            throw new OauthClientException("Failed to exchange authorization code to access token",e);
        }
    }
View Full Code Here

                params.put("scope", singletonList(join(Arrays.asList(scopes),",")));

            OauthToken resp = bees.formUrlEncoded(gcUrl+"/oauth/token", null, params).bind(OauthToken.class,bees);
            return resp;
        } catch (IOException e) {
            throw new OauthClientException("Failed to exchange authorization code to access token",e);
        }
    }
View Full Code Here

TOP

Related Classes of com.cloudbees.api.oauth.OauthClientException

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.