Search in sources :

Example 1 with UnauthorizedException

use of org.eclipse.che.api.core.UnauthorizedException in project che by eclipse.

the class ProjectManager method createBatchProjects.

/**
     * Create batch of projects according to their configurations.
     * <p/>
     * Notes: - a project will be created by importing when project configuration contains {@link SourceStorage} object,
     * otherwise this one will be created corresponding its {@link NewProjectConfig}:
     * <li> - {@link NewProjectConfig} object contains only one mandatory {@link NewProjectConfig#setPath(String)} field.
     * In this case Project will be created as project of {@link BaseProjectType} type </li>
     * <li> - a project will be created as project of {@link BaseProjectType} type with {@link Problem#code} = 12
     * when declared primary project type is not registered, </li>
     * <li> - a project will be created with {@link Problem#code} = 12 and without mixin project type
     * when declared mixin project type is not registered</li>
     * <li> - for creating a project by generator {@link NewProjectConfig#getOptions()} should be specified.</li>
     *
     * @param projectConfigList
     *         the list of configurations to create projects
     * @param rewrite
     *         whether rewrite or not (throw exception otherwise) if such a project exists
     * @return the list of new projects
     * @throws BadRequestException
     *         when {@link NewProjectConfig} object not contains mandatory {@link NewProjectConfig#setPath(String)} field.
     * @throws ConflictException
     *         when the same path project exists and {@code rewrite} is {@code false}
     * @throws ForbiddenException
     *         when trying to overwrite the project and this one contains at least one locked file
     * @throws NotFoundException
     *         when parent folder does not exist
     * @throws UnauthorizedException
     *         if user isn't authorized to access to location at importing source code
     * @throws ServerException
     *         if other error occurs
     */
public List<RegisteredProject> createBatchProjects(List<? extends NewProjectConfig> projectConfigList, boolean rewrite, ProjectOutputLineConsumerFactory lineConsumerFactory) throws BadRequestException, ConflictException, ForbiddenException, NotFoundException, ServerException, UnauthorizedException, IOException {
    fileWatcherManager.suspend();
    try {
        final List<RegisteredProject> projects = new ArrayList<>(projectConfigList.size());
        validateProjectConfigurations(projectConfigList, rewrite);
        final List<NewProjectConfig> sortedConfigList = projectConfigList.stream().sorted((config1, config2) -> config1.getPath().compareTo(config2.getPath())).collect(Collectors.toList());
        for (NewProjectConfig projectConfig : sortedConfigList) {
            RegisteredProject registeredProject;
            final String pathToProject = projectConfig.getPath();
            //creating project(by config or by importing source code)
            try {
                final SourceStorage sourceStorage = projectConfig.getSource();
                if (sourceStorage != null && !isNullOrEmpty(sourceStorage.getLocation())) {
                    doImportProject(pathToProject, sourceStorage, rewrite, lineConsumerFactory.setProjectName(projectConfig.getPath()));
                } else if (!isVirtualFileExist(pathToProject)) {
                    registeredProject = doCreateProject(projectConfig, projectConfig.getOptions());
                    projects.add(registeredProject);
                    continue;
                }
            } catch (Exception e) {
                if (!isVirtualFileExist(pathToProject)) {
                    //project folder is absent
                    rollbackCreatingBatchProjects(projects);
                    throw e;
                }
            }
            //update project
            if (isVirtualFileExist(pathToProject)) {
                try {
                    registeredProject = updateProject(projectConfig);
                } catch (Exception e) {
                    registeredProject = projectRegistry.putProject(projectConfig, asFolder(pathToProject), true, false);
                    final Problem problem = new Problem(NOT_UPDATED_PROJECT, "The project is not updated, caused by " + e.getLocalizedMessage());
                    registeredProject.getProblems().add(problem);
                }
            } else {
                registeredProject = projectRegistry.putProject(projectConfig, null, true, false);
            }
            projects.add(registeredProject);
        }
        return projects;
    } finally {
        fileWatcherManager.resume();
    }
}
Also used : LineConsumerFactory(org.eclipse.che.api.core.util.LineConsumerFactory) VirtualFileSystemProvider(org.eclipse.che.api.vfs.VirtualFileSystemProvider) Path(org.eclipse.che.api.vfs.Path) LoggerFactory(org.slf4j.LoggerFactory) ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) FileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) PreDestroy(javax.annotation.PreDestroy) FileWatcherManager(org.eclipse.che.api.vfs.watcher.FileWatcherManager) CreateProjectHandler(org.eclipse.che.api.project.server.handlers.CreateProjectHandler) Map(java.util.Map) PathMatcher(java.nio.file.PathMatcher) LoggingUncaughtExceptionHandler(org.eclipse.che.commons.lang.concurrent.LoggingUncaughtExceptionHandler) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) NOT_UPDATED_PROJECT(org.eclipse.che.api.core.ErrorCodes.NOT_UPDATED_PROJECT) SourceStorage(org.eclipse.che.api.core.model.project.SourceStorage) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) String.format(java.lang.String.format) List(java.util.List) BadRequestException(org.eclipse.che.api.core.BadRequestException) ProjectConfig(org.eclipse.che.api.core.model.project.ProjectConfig) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ProjectTypeResolution(org.eclipse.che.api.project.server.type.ProjectTypeResolution) BaseProjectType(org.eclipse.che.api.project.server.type.BaseProjectType) Strings.isNullOrEmpty(com.google.common.base.Strings.isNullOrEmpty) ProjectImporterRegistry(org.eclipse.che.api.project.server.importer.ProjectImporterRegistry) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) ArrayList(java.util.ArrayList) FileTreeWatcher(org.eclipse.che.api.vfs.impl.file.FileTreeWatcher) Inject(javax.inject.Inject) AttributeValue(org.eclipse.che.api.project.server.type.AttributeValue) VirtualFile(org.eclipse.che.api.vfs.VirtualFile) Searcher(org.eclipse.che.api.vfs.search.Searcher) FileWatcherEventType(org.eclipse.che.api.project.shared.dto.event.FileWatcherEventType) ConflictException(org.eclipse.che.api.core.ConflictException) SearcherProvider(org.eclipse.che.api.vfs.search.SearcherProvider) ProjectTypeDef(org.eclipse.che.api.project.server.type.ProjectTypeDef) VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) ExecutorService(java.util.concurrent.ExecutorService) Logger(org.slf4j.Logger) ProjectImporter(org.eclipse.che.api.project.server.importer.ProjectImporter) IOException(java.io.IOException) NotFoundException(org.eclipse.che.api.core.NotFoundException) ProjectType(org.eclipse.che.api.core.model.project.type.ProjectType) ServerException(org.eclipse.che.api.core.ServerException) Problem(org.eclipse.che.api.project.server.RegisteredProject.Problem) ForbiddenException(org.eclipse.che.api.core.ForbiddenException) NewProjectConfig(org.eclipse.che.api.core.model.project.NewProjectConfig) FileWatcherNotificationListener(org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener) SourceStorage(org.eclipse.che.api.core.model.project.SourceStorage) ArrayList(java.util.ArrayList) Problem(org.eclipse.che.api.project.server.RegisteredProject.Problem) NewProjectConfig(org.eclipse.che.api.core.model.project.NewProjectConfig) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) BadRequestException(org.eclipse.che.api.core.BadRequestException) ConflictException(org.eclipse.che.api.core.ConflictException) IOException(java.io.IOException) NotFoundException(org.eclipse.che.api.core.NotFoundException) ServerException(org.eclipse.che.api.core.ServerException) ForbiddenException(org.eclipse.che.api.core.ForbiddenException)

Example 2 with UnauthorizedException

use of org.eclipse.che.api.core.UnauthorizedException in project che by eclipse.

the class GitHubKeyUploader method uploadKey.

@Override
public void uploadKey(String publicKey) throws IOException, UnauthorizedException {
    final OAuthToken token = tokenProvider.getToken("github", EnvironmentContext.getCurrent().getSubject().getUserId());
    if (token == null || token.getToken() == null) {
        LOG.debug("Token not found, user need to authorize to upload key.");
        throw new UnauthorizedException("To upload SSH key you need to authorize.");
    }
    StringBuilder answer = new StringBuilder();
    final String url = String.format("https://api.github.com/user/keys?access_token=%s", token.getToken());
    final List<GitHubKey> gitHubUserPublicKeys = getUserPublicKeys(url, answer);
    for (GitHubKey gitHubUserPublicKey : gitHubUserPublicKeys) {
        if (publicKey.startsWith(gitHubUserPublicKey.getKey())) {
            return;
        }
    }
    final Map<String, String> postParams = new HashMap<>(2);
    postParams.put("title", "IDE SSH Key (" + new SimpleDateFormat().format(new Date()) + ")");
    postParams.put("key", new String(publicKey.getBytes()));
    final String postBody = JsonHelper.toJson(postParams);
    LOG.debug("Upload public key: {}", postBody);
    int responseCode;
    HttpURLConnection conn = null;
    try {
        conn = (HttpURLConnection) new URL(url).openConnection();
        conn.setInstanceFollowRedirects(false);
        conn.setRequestMethod(HttpMethod.POST);
        conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
        conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
        conn.setRequestProperty(HttpHeaders.CONTENT_LENGTH, String.valueOf(postBody.length()));
        conn.setDoOutput(true);
        try (OutputStream out = conn.getOutputStream()) {
            out.write(postBody.getBytes());
        }
        responseCode = conn.getResponseCode();
    } finally {
        if (conn != null) {
            conn.disconnect();
        }
    }
    LOG.debug("Upload key response code: {}", responseCode);
    if (responseCode != HttpURLConnection.HTTP_CREATED) {
        throw new IOException(String.format("%d: Failed to upload public key to https://github.com/", responseCode));
    }
}
Also used : HashMap(java.util.HashMap) OutputStream(java.io.OutputStream) IOException(java.io.IOException) Date(java.util.Date) URL(java.net.URL) OAuthToken(org.eclipse.che.api.auth.shared.dto.OAuthToken) HttpURLConnection(java.net.HttpURLConnection) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) GitHubKey(org.eclipse.che.plugin.github.shared.GitHubKey) SimpleDateFormat(java.text.SimpleDateFormat)

Example 3 with UnauthorizedException

use of org.eclipse.che.api.core.UnauthorizedException in project che by eclipse.

the class SubversionApi method getRevisions.

public GetRevisionsResponse getRevisions(GetRevisionsRequest request) throws IOException, SubversionException, UnauthorizedException {
    final File projectPath = new File(request.getProjectPath());
    final List<String> uArgs = defaultArgs();
    addOption(uArgs, "--revision", request.getRevisionRange());
    uArgs.add("log");
    final CommandLineResult result = runCommand(null, uArgs, projectPath, Arrays.asList(request.getPath()));
    final GetRevisionsResponse response = DtoFactory.getInstance().createDto(GetRevisionsResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
    if (result.getExitCode() == 0) {
        List<String> revisions = result.getStdout().parallelStream().filter(line -> line.split("\\|").length == 4).map(line -> line.split("\\|")[0].trim()).collect(Collectors.toList());
        response.withRevisions(revisions);
    }
    return response;
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) PropertySetRequest(org.eclipse.che.plugin.svn.shared.PropertySetRequest) UpdateRequest(org.eclipse.che.plugin.svn.shared.UpdateRequest) Arrays(java.util.Arrays) LineConsumerFactory(org.eclipse.che.api.core.util.LineConsumerFactory) InfoRequest(org.eclipse.che.plugin.svn.shared.InfoRequest) PropertyGetRequest(org.eclipse.che.plugin.svn.shared.PropertyGetRequest) ListResponse(org.eclipse.che.plugin.svn.shared.ListResponse) Date(java.util.Date) CopyRequest(org.eclipse.che.plugin.svn.shared.CopyRequest) LoggerFactory(org.slf4j.LoggerFactory) RemoveRequest(org.eclipse.che.plugin.svn.shared.RemoveRequest) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) Collections.singletonList(java.util.Collections.singletonList) SubversionUtils(org.eclipse.che.plugin.svn.server.utils.SubversionUtils) ZipUtils(org.eclipse.che.commons.lang.ZipUtils) ListRequest(org.eclipse.che.plugin.svn.shared.ListRequest) CleanupRequest(org.eclipse.che.plugin.svn.shared.CleanupRequest) Map(java.util.Map) CommitRequest(org.eclipse.che.plugin.svn.shared.CommitRequest) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) Path(java.nio.file.Path) PropertyDeleteRequest(org.eclipse.che.plugin.svn.shared.PropertyDeleteRequest) RepositoryUrlProvider(org.eclipse.che.plugin.svn.server.repository.RepositoryUrlProvider) ResolveRequest(org.eclipse.che.plugin.svn.shared.ResolveRequest) SwitchRequest(org.eclipse.che.plugin.svn.shared.SwitchRequest) DtoFactory.newDto(org.eclipse.che.dto.server.DtoFactory.newDto) NotNull(javax.validation.constraints.NotNull) Collectors(java.util.stream.Collectors) Nullable(org.eclipse.che.commons.annotation.Nullable) IoUtil(org.eclipse.che.commons.lang.IoUtil) SshScriptProvider(org.eclipse.che.plugin.ssh.key.script.SshScriptProvider) List(java.util.List) HttpHeaders(javax.ws.rs.core.HttpHeaders) Response(javax.ws.rs.core.Response) Predicate(com.google.common.base.Predicate) MergeRequest(org.eclipse.che.plugin.svn.shared.MergeRequest) InfoUtils.getRelativeUrl(org.eclipse.che.plugin.svn.server.utils.InfoUtils.getRelativeUrl) ShowLogRequest(org.eclipse.che.plugin.svn.shared.ShowLogRequest) InfoResponse(org.eclipse.che.plugin.svn.shared.InfoResponse) CommandLineResult(org.eclipse.che.plugin.svn.server.upstream.CommandLineResult) SubversionItem(org.eclipse.che.plugin.svn.shared.SubversionItem) Singleton(com.google.inject.Singleton) SubversionUtils.recognizeProjectUri(org.eclipse.che.plugin.svn.server.utils.SubversionUtils.recognizeProjectUri) Iterables(com.google.common.collect.Iterables) LockRequest(org.eclipse.che.plugin.svn.shared.LockRequest) CLIOutputResponseList(org.eclipse.che.plugin.svn.shared.CLIOutputResponseList) GetRevisionsRequest(org.eclipse.che.plugin.svn.shared.GetRevisionsRequest) Strings.isNullOrEmpty(com.google.common.base.Strings.isNullOrEmpty) HashMap(java.util.HashMap) CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ApiException(org.eclipse.che.api.core.ApiException) Files(com.google.common.io.Files) SshEnvironment(org.eclipse.che.plugin.svn.server.utils.SshEnvironment) InfoUtils.getRepositoryRoot(org.eclipse.che.plugin.svn.server.utils.InfoUtils.getRepositoryRoot) DtoFactory(org.eclipse.che.dto.server.DtoFactory) MediaType(com.google.common.net.MediaType) GetRevisionsResponse(org.eclipse.che.plugin.svn.shared.GetRevisionsResponse) Logger(org.slf4j.Logger) ErrorCodes(org.eclipse.che.api.core.ErrorCodes) Iterator(java.util.Iterator) IOException(java.io.IOException) StatusRequest(org.eclipse.che.plugin.svn.shared.StatusRequest) File(java.io.File) InfoUtils(org.eclipse.che.plugin.svn.server.utils.InfoUtils) PropertyListRequest(org.eclipse.che.plugin.svn.shared.PropertyListRequest) ShowDiffRequest(org.eclipse.che.plugin.svn.shared.ShowDiffRequest) ServerException(org.eclipse.che.api.core.ServerException) UpstreamUtils(org.eclipse.che.plugin.svn.server.upstream.UpstreamUtils) AddRequest(org.eclipse.che.plugin.svn.shared.AddRequest) RevertRequest(org.eclipse.che.plugin.svn.shared.RevertRequest) DeleteOnCloseFileInputStream(org.eclipse.che.api.vfs.util.DeleteOnCloseFileInputStream) MoveRequest(org.eclipse.che.plugin.svn.shared.MoveRequest) CommandLineResult(org.eclipse.che.plugin.svn.server.upstream.CommandLineResult) GetRevisionsResponse(org.eclipse.che.plugin.svn.shared.GetRevisionsResponse) File(java.io.File)

Example 4 with UnauthorizedException

use of org.eclipse.che.api.core.UnauthorizedException in project che by eclipse.

the class DefaultHttpJsonRequest method doRequest.

/**
     * Makes this request using {@link HttpURLConnection}.
     *
     * <p>Uses {@link HttpHeaders#AUTHORIZATION} header with value from {@link EnvironmentContext}.
     * <br>uses {@link HttpHeaders#ACCEPT} header with "application/json" value.
     * <br>Encodes query parameters in "UTF-8".
     *
     * @param timeout
     *         request timeout, used only if it is greater than 0
     * @param url
     *         request url
     * @param method
     *         request method
     * @param body
     *         request body, must be instance of {@link JsonSerializable}
     * @param parameters
     *         query parameters, may be null
     * @param authorizationHeaderValue
     *         value of authorization header, may be null
     * @return response to this request
     * @throws IOException
     *         when connection content type is not "application/json"
     * @throws ServerException
     *         when response code is 500 or it is different from 400, 401, 403, 404, 409
     * @throws ForbiddenException
     *         when response code is 403
     * @throws NotFoundException
     *         when response code is 404
     * @throws UnauthorizedException
     *         when response code is 401
     * @throws ConflictException
     *         when response code is 409
     * @throws BadRequestException
     *         when response code is 400
     */
protected DefaultHttpJsonResponse doRequest(int timeout, String url, String method, Object body, List<Pair<String, ?>> parameters, String authorizationHeaderValue) throws IOException, ServerException, ForbiddenException, NotFoundException, UnauthorizedException, ConflictException, BadRequestException {
    final String authToken = EnvironmentContext.getCurrent().getSubject().getToken();
    final boolean hasQueryParams = parameters != null && !parameters.isEmpty();
    if (hasQueryParams || authToken != null) {
        final UriBuilder ub = UriBuilder.fromUri(url);
        //remove sensitive information from url.
        ub.replaceQueryParam("token", EMPTY_ARRAY);
        if (hasQueryParams) {
            for (Pair<String, ?> parameter : parameters) {
                ub.queryParam(parameter.first, parameter.second);
            }
        }
        url = ub.build().toString();
    }
    final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
    conn.setConnectTimeout(timeout > 0 ? timeout : 60000);
    conn.setReadTimeout(timeout > 0 ? timeout : 60000);
    try {
        conn.setRequestMethod(method);
        //drop a hint for server side that we want to receive application/json
        conn.addRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
        if (!isNullOrEmpty(authorizationHeaderValue)) {
            conn.setRequestProperty(HttpHeaders.AUTHORIZATION, authorizationHeaderValue);
        } else if (authToken != null) {
            conn.setRequestProperty(HttpHeaders.AUTHORIZATION, authToken);
        }
        if (body != null) {
            conn.addRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            conn.setDoOutput(true);
            if (HttpMethod.DELETE.equals(method)) {
                //to avoid jdk bug described here http://bugs.java.com/view_bug.do?bug_id=7157360
                conn.setRequestMethod(HttpMethod.POST);
                conn.setRequestProperty("X-HTTP-Method-Override", HttpMethod.DELETE);
            }
            try (OutputStream output = conn.getOutputStream()) {
                output.write(DtoFactory.getInstance().toJson(body).getBytes());
            }
        }
        final int responseCode = conn.getResponseCode();
        if ((responseCode / 100) != 2) {
            InputStream in = conn.getErrorStream();
            if (in == null) {
                in = conn.getInputStream();
            }
            final String str;
            try (Reader reader = new InputStreamReader(in)) {
                str = CharStreams.toString(reader);
            }
            final String contentType = conn.getContentType();
            if (contentType != null && contentType.startsWith(MediaType.APPLICATION_JSON)) {
                final ServiceError serviceError = DtoFactory.getInstance().createDtoFromJson(str, ServiceError.class);
                if (serviceError.getMessage() != null) {
                    if (responseCode == Response.Status.FORBIDDEN.getStatusCode()) {
                        throw new ForbiddenException(serviceError);
                    } else if (responseCode == Response.Status.NOT_FOUND.getStatusCode()) {
                        throw new NotFoundException(serviceError);
                    } else if (responseCode == Response.Status.UNAUTHORIZED.getStatusCode()) {
                        throw new UnauthorizedException(serviceError);
                    } else if (responseCode == Response.Status.CONFLICT.getStatusCode()) {
                        throw new ConflictException(serviceError);
                    } else if (responseCode == Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) {
                        throw new ServerException(serviceError);
                    } else if (responseCode == Response.Status.BAD_REQUEST.getStatusCode()) {
                        throw new BadRequestException(serviceError);
                    }
                    throw new ServerException(serviceError);
                }
            }
            // Can't parse content as json or content has format other we expect for error.
            throw new IOException(String.format("Failed access: %s, method: %s, response code: %d, message: %s", UriBuilder.fromUri(url).replaceQuery("token").build(), method, responseCode, str));
        }
        final String contentType = conn.getContentType();
        if (contentType != null && !contentType.startsWith(MediaType.APPLICATION_JSON)) {
            throw new IOException(conn.getResponseMessage());
        }
        try (Reader reader = new InputStreamReader(conn.getInputStream())) {
            return new DefaultHttpJsonResponse(CharStreams.toString(reader), responseCode);
        }
    } finally {
        conn.disconnect();
    }
}
Also used : ServiceError(org.eclipse.che.api.core.rest.shared.dto.ServiceError) ForbiddenException(org.eclipse.che.api.core.ForbiddenException) ServerException(org.eclipse.che.api.core.ServerException) InputStreamReader(java.io.InputStreamReader) ConflictException(org.eclipse.che.api.core.ConflictException) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) NotFoundException(org.eclipse.che.api.core.NotFoundException) IOException(java.io.IOException) URL(java.net.URL) HttpURLConnection(java.net.HttpURLConnection) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) BadRequestException(org.eclipse.che.api.core.BadRequestException) UriBuilder(javax.ws.rs.core.UriBuilder)

Example 5 with UnauthorizedException

use of org.eclipse.che.api.core.UnauthorizedException in project che by eclipse.

the class GitHubFactory method getToken.

private String getToken() throws ServerException, UnauthorizedException {
    OAuthToken token;
    try {
        token = oauthTokenProvider.getToken("github", EnvironmentContext.getCurrent().getSubject().getUserId());
    } catch (IOException e) {
        throw new ServerException(e.getMessage());
    }
    String oauthToken = token != null ? token.getToken() : null;
    if (oauthToken == null || oauthToken.isEmpty()) {
        throw new UnauthorizedException("User doesn't have access token to github");
    }
    return oauthToken;
}
Also used : OAuthToken(org.eclipse.che.api.auth.shared.dto.OAuthToken) ServerException(org.eclipse.che.api.core.ServerException) UnauthorizedException(org.eclipse.che.api.core.UnauthorizedException) IOException(java.io.IOException)

Aggregations

UnauthorizedException (org.eclipse.che.api.core.UnauthorizedException)11 IOException (java.io.IOException)10 ServerException (org.eclipse.che.api.core.ServerException)8 ArrayList (java.util.ArrayList)4 NotFoundException (org.eclipse.che.api.core.NotFoundException)4 Logger (org.slf4j.Logger)4 LoggerFactory (org.slf4j.LoggerFactory)4 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)3 File (java.io.File)3 HashMap (java.util.HashMap)3 BadRequestException (org.eclipse.che.api.core.BadRequestException)3 ConflictException (org.eclipse.che.api.core.ConflictException)3 ForbiddenException (org.eclipse.che.api.core.ForbiddenException)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Files (com.google.common.io.Files)2 JSch (com.jcraft.jsch.JSch)2 Session (com.jcraft.jsch.Session)2 OutputStream (java.io.OutputStream)2 String.format (java.lang.String.format)2 Date (java.util.Date)2