public HttpResponse doFinishLogin(StaplerRequest request, StaplerResponse rsp) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } String content = postForAccessToken(code); String accessToken = extractToken(content); updateOfflineAccessTokenForUser(accessToken); request.getSession().setAttribute("access_token", accessToken); String newProjectSetupUrl = getJenkinsRootUrl() + "/" + GithubReposController.URL; return HttpResponses.redirectTo(newProjectSetupUrl); }
/** * Bare-minimum configuration mechanism to change the update center. */ public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException { Hudson hudson = Hudson.getInstance(); hudson.checkPermission(Hudson.ADMINISTER); UpdateCenter uc = hudson.getUpdateCenter(); PersistedList<UpdateSite> sites = uc.getSites(); for (UpdateSite s : sites) { if (s.getId().equals("default")) sites.remove(s); } sites.add(new UpdateSite("default",site)); return HttpResponses.redirectToContextRoot(); }
/** * Bare-minimum configuration mechanism to change the update center. */ public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException { Hudson hudson = Hudson.getInstance(); hudson.checkPermission(Hudson.ADMINISTER); UpdateCenter uc = hudson.getUpdateCenter(); PersistedList<UpdateSite> sites = uc.getSites(); for (UpdateSite s : sites) { if (s.getId().equals("default")) sites.remove(s); } sites.add(new UpdateSite("default",site)); return HttpResponses.redirectToContextRoot(); }
/** * Bare-minimum configuration mechanism to change the update center. */ public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException { Hudson hudson = Hudson.getInstance(); hudson.checkPermission(Hudson.ADMINISTER); UpdateCenter uc = hudson.getUpdateCenter(); PersistedList<UpdateSite> sites = uc.getSites(); for (UpdateSite s : sites) { if (s.getId().equals("default")) sites.remove(s); } sites.add(new UpdateSite("default",site)); return HttpResponses.redirectToContextRoot(); }
return HttpResponses.redirectToContextRoot(); return HttpResponses.redirectToContextRoot(); // referer should be always there, but be defensive
/** * Bare-minimum configuration mechanism to change the update center. */ public HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException { Hudson hudson = Hudson.getInstance(); hudson.checkPermission(Hudson.ADMINISTER); UpdateCenter uc = hudson.getUpdateCenter(); PersistedList<UpdateSite> sites = uc.getSites(); for (UpdateSite s : sites) { if (s.getId().equals("default")) { sites.remove(s); } } sites.add(new UpdateSite("default", site)); return HttpResponses.redirectToContextRoot(); }