Package com.almende.eve.entity.calendar

Examples of com.almende.eve.entity.calendar.Authorization


    ObjectNode info = JOM.getInstance().readValue(resp, ObjectNode.class);
    String email = info.has("email") ? info.get("email").asText() : null;
    String name = info.has("name") ? info.get("name").asText() : null;
   
    DateTime expires_at = calculateExpiresAt(expires_in);
    Authorization auth = new Authorization(access_token, token_type,
        expires_at, refresh_token);
   
    // store the tokens in the state
    state.put("auth", auth);
    state.put("email", email);
View Full Code Here


   * Example usage: HttpUtil.get(url, getAuthorizationHeaders());
   * @return
   * @throws Exception
   */
  private Map<String, String> getAuthorizationHeaders () throws Exception {
    Authorization auth = getAuthorization();
   
    String access_token = (auth != null) ? auth.getAccessToken() : null;
    if (access_token == null) {
      throw new Exception("No authorization token available");
    }
    String token_type = (auth != null) ? auth.getTokenType() : null;
    if (token_type == null) {
      throw new Exception("No token type available");
    }
   
    Map<String, String> headers = new HashMap<String, String>();
View Full Code Here

   * Retrieve authorization tokens
   * @return
   * @throws Exception
   */
  private Authorization getAuthorization() throws Exception {
    Authorization auth = (Authorization) getState().get("auth");

    // check if access_token is expired
    DateTime expires_at = (auth != null) ? auth.getExpiresAt() : null;
    if (expires_at != null && expires_at.isBeforeNow()) {
      refreshAuthorization(auth);
      getState().put("auth", auth);
    }
   
View Full Code Here

    ObjectNode info = JOM.getInstance().readValue(resp, ObjectNode.class);
    String email = info.has("email") ? info.get("email").asText() : null;
    String name = info.has("name") ? info.get("name").asText() : null;
   
    DateTime expires_at = calculateExpiresAt(expires_in);
    Authorization auth = new Authorization(access_token, token_type,
        expires_at, refresh_token);
   
    // store the tokens in the state
    state.put("auth", auth);
    state.put("email", email);
View Full Code Here

   * Example usage: HttpUtil.get(url, getAuthorizationHeaders());
   * @return
   * @throws Exception
   */
  private Map<String, String> getAuthorizationHeaders () throws Exception {
    Authorization auth = getAuthorization();
   
    String access_token = (auth != null) ? auth.getAccessToken() : null;
    if (access_token == null) {
      throw new Exception("No authorization token available");
    }
    String token_type = (auth != null) ? auth.getTokenType() : null;
    if (token_type == null) {
      throw new Exception("No token type available");
    }
   
    Map<String, String> headers = new HashMap<String, String>();
View Full Code Here

   * Retrieve authorization tokens
   * @return
   * @throws Exception
   */
  private Authorization getAuthorization() throws Exception {
    Authorization auth = (Authorization) getState().get("auth");

    // check if access_token is expired
    DateTime expires_at = (auth != null) ? auth.getExpiresAt() : null;
    if (expires_at != null && expires_at.isBeforeNow()) {
      // TODO: remove this logging
      logger.info("access token is expired. refreshing now...");
      refreshAuthorization(auth);
      getState().put("auth", auth);
View Full Code Here

    ObjectNode info = JOM.getInstance().readValue(resp, ObjectNode.class);
    String email = info.has("email") ? info.get("email").asText() : null;
    String name = info.has("name") ? info.get("name").asText() : null;
   
    DateTime expires_at = calculateExpiresAt(expires_in);
    Authorization auth = new Authorization(access_token, token_type,
        expires_at, refresh_token);
   
    // store the tokens in the state
    state.put("auth", auth);
    state.put("email", email);
View Full Code Here

   * Example usage: HttpUtil.get(url, getAuthorizationHeaders());
   * @return
   * @throws Exception
   */
  private Map<String, String> getAuthorizationHeaders () throws Exception {
    Authorization auth = getAuthorization();
   
    String access_token = (auth != null) ? auth.getAccessToken() : null;
    if (access_token == null) {
      throw new Exception("No authorization token available");
    }
    String token_type = (auth != null) ? auth.getTokenType() : null;
    if (token_type == null) {
      throw new Exception("No token type available");
    }
   
    Map<String, String> headers = new HashMap<String, String>();
View Full Code Here

   * Retrieve authorization tokens
   * @return
   * @throws Exception
   */
  private Authorization getAuthorization() throws Exception {
    Authorization auth = getState().get("auth",Authorization.class);

    // check if access_token is expired
    DateTime expires_at = (auth != null) ? auth.getExpiresAt() : null;
    if (expires_at != null && expires_at.isBeforeNow()) {
      // TODO: remove this logging
      logger.info("access token is expired. refreshing now...");
      refreshAuthorization(auth);
      getState().put("auth", auth);
View Full Code Here

    ObjectNode info = JOM.getInstance().readValue(resp, ObjectNode.class);
    String email = info.has("email") ? info.get("email").asText() : null;
    String name = info.has("name") ? info.get("name").asText() : null;
   
    DateTime expires_at = calculateExpiresAt(expires_in);
    Authorization auth = new Authorization(access_token, token_type,
        expires_at, refresh_token);
   
    // store the tokens in the state
    state.put("auth", auth);
    state.put("email", email);
View Full Code Here

TOP

Related Classes of com.almende.eve.entity.calendar.Authorization

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.