@see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
(String id, String secret)
| 234 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
| 235 | */ |
| 236 | protected String createToken(String id, String secret) |
| 237 | throws UnauthorizedException |
| 238 | { |
| 239 | String key = createTokenKey(id, secret); |
| 240 | |
| 241 | if (!cache.containsKey(key)) |
| 242 | { |
| 243 | String token = Utils.generateToken(32); |
| 244 | cache.put(key, token); |
| 245 | |
| 246 | debug("createToken key=" + key + " token=" + token); |
| 247 | |
| 248 | return token; |
| 249 | } |
| 250 | else |
| 251 | { |
| 252 | throw new UnauthorizedException(); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Removes the given patch if the secret does not match. |
no test coverage detected