Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Commit

Permalink
Fix stored procedure error with expired check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-M committed Feb 16, 2017
1 parent 39efbb6 commit bbca6c8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $$
WHERE oat_token = token
AND (oat_bound_ip is NULL OR oat_bound_ip = bind_ip)
AND (oat_bound_session_id is NULL or oat_bound_session_id = session_id)
AND oat_bound_expires IS NULL OR oat_bound_expires > NOW()
AND (oat_bound_expires IS NULL OR oat_bound_expires > NOW())
RETURNING oat_token, oat_created, oat_bound_at, oat_bound_ip, oat_bound_expires;
$$
LANGUAGE 'sql' VOLATILE SECURITY DEFINER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public ResponseEntity<String> getByEMail(@RequestParam(value="mail") String mail
return new ResponseEntity<>("SEND_FAILED", HttpStatus.INTERNAL_SERVER_ERROR);
}

// @RequestMapping("/tv/{token}")
@RequestMapping("/tv/{token}")
public String handleToken(@PathVariable String token,
@RequestHeader(name = X_FORWARDED_FOR, required = false) String bindIp,
HttpServletRequest request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ oneTimeTokenService, new ControllerProperties()))
.alwaysDo(MockMvcResultHandlers.print()).build();
}

// @Test
@Test
public void happyCase() throws Exception {
when(onetimeTokensSProcService.bindOnetimeToken(eq("1234567"), eq("192.168.23.12"),
eq("987654321"))).thenReturn(singletonList(new OnetimeTokenInfo()));
Expand All @@ -61,7 +61,7 @@ public void happyCase() throws Exception {
eq("192.168.23.12"), eq("987654321"));
}

// @Test
@Test
public void invalidEmails() throws Exception {
mockMvc.perform(post("/tv/by-email")
.header("X-FORWARDED-FOR", "192.168.23.12")
Expand All @@ -76,7 +76,7 @@ public void invalidEmails() throws Exception {
.andExpect(status().is(400));
}

// @Test
@Test
public void validEmail() throws Exception {
mockMvc.perform(post("/tv/by-email")
.header("X-FORWARDED-FOR", "192.168.23.12")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public class WebSecurityConstants {

public static String[] IGNORED_PATHS = new String[]{
"/logo.png","/clean.png","/warning.png", "/favicon.ico", "/asset/**", "/styles/**", "/js/**", "/lib/**",
"/grafana/public/**"};
"/grafana/public/**",
"/tv/**"};
}

0 comments on commit bbca6c8

Please sign in to comment.