From 697955e98a9e94f16e704700528e20fff2cdbef0 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 5 Aug 2013 11:12:53 +0100 Subject: [PATCH] Remove gs-* links --- app.groovy | 59 +-------------------------------------------- templates/home.html | 13 +++------- 2 files changed, 5 insertions(+), 67 deletions(-) diff --git a/app.groovy b/app.groovy index b84f3448..3e871e83 100644 --- a/app.groovy +++ b/app.groovy @@ -1,5 +1,6 @@ package app +@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.M1") @Grab("org.codehaus.groovy:groovy-ant:2.1.6") @Grab("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2") @Grab(group='net.sf.json-lib', module='json-lib', version='2.3', classifier='jdk15') @@ -18,8 +19,6 @@ class MainController { @Autowired private Reactor reactor - private gettingStartedRepos = [] - @RequestMapping("/") @ResponseBody String home() { @@ -108,35 +107,6 @@ class MainController { new ResponseEntity(body, ["Content-Type":"application/octet-stream"] as HttpHeaders, HttpStatus.OK) } - @RequestMapping("/gs") - @ResponseBody - String gettingStartedList(@RequestHeader("Authorization") auth) { - if (gettingStartedRepos.empty) { - RESTClient github = new RESTClient("https://api.github.com") - if (auth) { - github.headers['Authorization'] = auth - } - github.headers['User-Agent'] = 'Mozilla/4.0' - def names = github.get( path : "orgs/springframework-meta/repos").data.collect { it.name } - names = names.findAll { it.startsWith "gs-"} - gettingStartedRepos = names.collect { [repo:it, name:it.split("-").findAll{it!="gs"}.collect{it.capitalize()}.join(" ")]} - } - template "gs.html", [repos:gettingStartedRepos] - } - - @RequestMapping("/gs/{repo}") - @ResponseBody - ResponseEntity gettingStartedProject(java.security.Principal principal, @RequestHeader("Authorization") auth, @PathVariable String repo) { - RESTClient github = new RESTClient("https://api.github.com") - if (auth) { - github.headers['Authorization'] = auth - } - github.headers['User-Agent'] = 'Mozilla/4.0' - def body = github.get( path : "repos/springframework-meta/${repo}/zipball/master").data.bytes - log.info("Downloaded: " + body.length + " bytes of ${repo} for ${principal.name}") - new ResponseEntity(body, ["Content-Type":"application/zip"] as HttpHeaders, HttpStatus.OK) - } - } import reactor.spring.context.ConsumerBeanPostProcessor; @@ -185,33 +155,6 @@ class TemporaryFileCleaner { } -@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.M1") -import org.springframework.boot.ops.properties.SecurityProperties -@EnableWebSecurity -@Configuration -@Log -class SecurityConfiguration { - - @Bean(name = "org.springframework.boot.ops.properties.SecurityProperties") - SecurityProperties securityProperties() { - SecurityProperties security = new SecurityProperties() - security.getBasic().setPath("/gs/**") - security.getBasic().setRealm("Github Credentials") - security - } - - @Bean - AuthenticationManager authenticationManager() { - new AuthenticationManager() { - Authentication authenticate(Authentication authentication) { - log.info("Authenticating: " + authentication.name) - new UsernamePasswordAuthenticationToken(authentication.name, "", AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER")) - } - } - } - -} - class PomRequest { def style = [] diff --git a/templates/home.html b/templates/home.html index 77308492..d73d7317 100644 --- a/templates/home.html +++ b/templates/home.html @@ -14,24 +14,19 @@ Spring