コード例 #1
0
  /**
   * Logins to Codenvy SaaS.
   *
   * @throws org.eclipse.che.api.auth.AuthenticationException if login fails
   * @throws IOException if unexpected error occurred
   */
  public Token login(Credentials credentials) throws AuthenticationException, IOException {
    String requestUrl = combinePaths(saasApiEndpoint, "/auth/login");

    String response;
    try {
      response = transport.doPost(requestUrl, credentials);
    } catch (HttpException e) {
      throw new AuthenticationException();
    }

    return createDtoFromJson(response, Token.class);
  }
コード例 #2
0
 /**
  * Logout from Codenvy SaaS.
  *
  * @throws IOException if unexpected error occurred
  */
 public void logout(String authToken) throws IOException {
   String requestUrl = combinePaths(saasApiEndpoint, "/auth/logout?token=" + authToken);
   transport.doPost(requestUrl, null);
 }