Tabnine Logo
ServiceNotAuthorizedException
Code IndexAdd Tabnine to your IDE (free)

How to use
ServiceNotAuthorizedException
in
org.eclipse.jgit.transport.resolver

Best Java code snippets using org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException (Showing top 10 results out of 315)

origin: sonia.jgit/org.eclipse.jgit.http.server

public ReceivePack create(final HttpServletRequest req, final Repository db)
    throws ServiceNotEnabledException, ServiceNotAuthorizedException {
  final ServiceConfig cfg = db.getConfig().get(CONFIG);
  String user = req.getRemoteUser();
  if (cfg.set) {
    if (cfg.enabled) {
      if (user == null || "".equals(user))
        user = "anonymous";
      return createFor(req, db, user);
    }
    throw new ServiceNotEnabledException();
  }
  if (user != null && !"".equals(user))
    return createFor(req, db, user);
  throw new ServiceNotAuthorizedException();
}
origin: sonia.jgit/org.eclipse.jgit.http.server

  public void doFilter(ServletRequest request, ServletResponse response,
      FilterChain chain) throws IOException, ServletException {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;
    try {
      final Repository db = getRepository(request);
      asIs.access(req, db);
      chain.doFilter(request, response);
    } catch (ServiceNotAuthorizedException e) {
      res.sendError(SC_UNAUTHORIZED, e.getMessage());
    } catch (ServiceNotEnabledException e) {
      res.sendError(SC_FORBIDDEN, e.getMessage());
    }
  }
}
origin: com.madgag/org.eclipse.jgit.http.server

public ReceivePack create(final HttpServletRequest req, final Repository db)
    throws ServiceNotEnabledException, ServiceNotAuthorizedException {
  final ServiceConfig cfg = db.getConfig().get(CONFIG);
  String user = req.getRemoteUser();
  if (cfg.set) {
    if (cfg.enabled) {
      if (user == null || "".equals(user))
        user = "anonymous";
      return createFor(req, db, user);
    }
    throw new ServiceNotEnabledException();
  }
  if (user != null && !"".equals(user))
    return createFor(req, db, user);
  throw new ServiceNotAuthorizedException();
}
origin: sonia.jgit/org.eclipse.jgit.http.server

public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
  HttpServletRequest req = (HttpServletRequest) request;
  HttpServletResponse rsp = (HttpServletResponse) response;
  UploadPack rp;
  try {
    rp = uploadPackFactory.create(req, getRepository(req));
  } catch (ServiceNotAuthorizedException e) {
    rsp.sendError(SC_UNAUTHORIZED, e.getMessage());
    return;
  } catch (ServiceNotEnabledException e) {
    sendError(req, rsp, SC_FORBIDDEN, e.getMessage());
    return;
  }
  try {
    req.setAttribute(ATTRIBUTE_HANDLER, rp);
    chain.doFilter(req, rsp);
  } finally {
    req.removeAttribute(ATTRIBUTE_HANDLER);
  }
}
origin: com.atlassian.labs/speakeasy-plugin

  public ReceivePack create(HttpServletRequest req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException
  {
    String user = userManager.getRemoteUsername(req);
    String pluginKey = repo.getWorkTree().getName();
    UserProfile userProfile = userManager.getUserProfile(user);

    final UserExtension userExtension = speakeasyService.getRemotePlugin(pluginKey, user);
    if (userExtension != null && !userExtension.isCanEdit())
    {
      throw new ServiceNotAuthorizedException();
    }
    ReceiveCommits rc = new ReceiveCommits(userProfile, userExtension, repo, speakeasyService, gitRepositoryManager);
    return rc.getReceivePack();
  }
}
origin: sonia.jgit/org.eclipse.jgit.http.server

public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
  HttpServletRequest req = (HttpServletRequest) request;
  HttpServletResponse rsp = (HttpServletResponse) response;
  ReceivePack rp;
  try {
    rp = receivePackFactory.create(req, getRepository(req));
  } catch (ServiceNotAuthorizedException e) {
    rsp.sendError(SC_UNAUTHORIZED, e.getMessage());
    return;
  } catch (ServiceNotEnabledException e) {
    sendError(req, rsp, SC_FORBIDDEN, e.getMessage());
    return;
  }
  try {
    req.setAttribute(ATTRIBUTE_HANDLER, rp);
    chain.doFilter(req, rsp);
  } finally {
    req.removeAttribute(ATTRIBUTE_HANDLER);
  }
}
origin: winstonli/writelatex-git-bridge

  throw new ServiceMayNotContinueException(e);
} catch (ForbiddenException e) {
  throw new ServiceNotAuthorizedException();
} catch (GitUserException e) {
  throw new ServiceMayNotContinueException(e.getMessage(), e);
origin: sonia.jgit/org.eclipse.jgit.http.server

  return;
} catch (ServiceNotAuthorizedException e) {
  res.sendError(SC_UNAUTHORIZED, e.getMessage());
  return;
} catch (ServiceMayNotContinueException e) {
origin: sonia.jgit/org.eclipse.jgit.http.server

public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
  final HttpServletRequest req = (HttpServletRequest) request;
  final HttpServletResponse res = (HttpServletResponse) response;
  if (svc.equals(req.getParameter("service"))) {
    final Repository db = getRepository(req);
    try {
      begin(req, db);
    } catch (ServiceNotAuthorizedException e) {
      res.sendError(SC_UNAUTHORIZED, e.getMessage());
      return;
    } catch (ServiceNotEnabledException e) {
      sendError(req, res, SC_FORBIDDEN, e.getMessage());
      return;
    }
    try {
      if (filters.length == 0)
        service(req, response);
      else
        new Chain().doFilter(request, response);
    } finally {
      req.removeAttribute(ATTRIBUTE_HANDLER);
    }
  } else {
    chain.doFilter(request, response);
  }
}
origin: sonia.jgit/org.eclipse.jgit.http.server

private void service(ServletRequest request, ServletResponse response)
    throws IOException {
  final HttpServletRequest req = (HttpServletRequest) request;
  final HttpServletResponse res = (HttpServletResponse) response;
  final SmartOutputStream buf = new SmartOutputStream(req, res, true);
  try {
    res.setContentType(infoRefsResultType(svc));
    final PacketLineOut out = new PacketLineOut(buf);
    out.writeString("# service=" + svc + "\n");
    out.end();
    advertise(req, new PacketLineOutRefAdvertiser(out));
    buf.close();
  } catch (ServiceNotAuthorizedException e) {
    res.sendError(SC_UNAUTHORIZED, e.getMessage());
  } catch (ServiceNotEnabledException e) {
    sendError(req, res, SC_FORBIDDEN, e.getMessage());
  } catch (ServiceMayNotContinueException e) {
    if (e.isOutput())
      buf.close();
    else
      sendError(req, res, e.getStatusCode(), e.getMessage());
  }
}
org.eclipse.jgit.transport.resolverServiceNotAuthorizedException

Javadoc

Indicates that the requested service requires authentication that the current user has not provided.

This corresponds to response code HttpServletResponse.SC_UNAUTHORIZED.

Most used methods

  • <init>
    Constructor for ServiceNotAuthorizedException.
  • getMessage

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now