# Is this possible with a plugin

**URL:** <https://discuss.konghq.com/t/is-this-possible-with-a-plugin/2919>\
**Category:** Questions\
**Created:** [February 28, 2019, 6:14pm UTC](https://discuss.konghq.com/t/is-this-possible-with-a-plugin/2919 "2019-02-28T18:14:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hedersknyffel](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@Hedersknyffel](https://discuss.konghq.com/u/Hedersknyffel)\
**Post date:** [February 28, 2019, 6:14pm UTC](https://discuss.konghq.com/t/is-this-possible-with-a-plugin/2919/1 "2019-02-28T18:14:17Z")

</div>

I’m learning Lua from scratch, thinking about creating a plugin that works like this:

Use case 1:  
A website or React app sends a request to kong with NO UserId in a header and NO JWT.  
Kong sends the request on it’s way to the intended microservice (guest mode).

Use case 2:  
A website or React app sends a request to kong with a UserId in a header.  
If there are no JWT the plugin will redirect the request to a webpage which creates the JWT and redirects back to Kong, which in turn send the request on it’s way to the intended microservice which uses the JWT.

Use case 3:  
A website or React app sends a request to kong with a UserId in a header AND a JWT.  
Kong send the request on it’s way to the intended microservice which uses the JWT.

I hope I make some kind of sense.  
Is this possible to do? Is it hard or easy? Are there already some solution to this out there? If not, I would greatly appreciate some general pointers to how I should go about doing this. I’ve been programming for some time but  
never touched Lua ^^.

Thanks
