示例#1
0
 public function installK2(StoreK2Request $request, MessagingResource $resource)
 {
     // TODO: this cannot be hardcoded, depends on resource type
     // Also make sure that by injecting a crafted resource id it won't be possible to override other keys!
     Cache::put("K2_SLOT_" . $resource->getResourceId(), $request->k2->toJson(), 0);
     return response(null, 204);
 }
 public function authorize(MessagingResource $resource, K1 $k1)
 {
     if (hash("sha256", $k1->secret) !== $resource->getResourceId()) {
         throw new UnauthorizedException();
     }
 }
 /**
  * @param Request $request
  * @param MessagingResource $resource
  * @return string
  * @throws \App\Exceptions\InvalidMessageException
  * @internal param $slotId
  * @internal param $pipe
  */
 public function store(Request $request, MessagingResource $resource)
 {
     $value = $request->get('value');
     $resource->addMessage($value);
     return response($resource->peekMessage(), 201)->header("Content-Type", "text/json");
 }